Note that there are some explanatory texts on larger screens.

plurals
  1. POFragment Back button pressed which method is called or how to call user defined function
    text
    copied!<p>I have one ActionbarSherlock Activity and 3 Actionbar Tab.The second tab having two Fragments(A and B). The Fragment "A" having the list calendar and Fragment "B" having the Task adding functionalities.When i click the Fragment "A" list calendar items it will be go to the Fragment "B". Then I add some task in fragment "B" and then press back button to redirect Fragment "A" fine.My problem is when i back to the Fragment "A" from Fragment "B" which method is called and also i update the task details when back to the Fragment "A".Thanks...</p> <p>ActionbarActivityclass:</p> <blockquote> <p>When i select the second Actionbar Tab that having two fragments ListCalendarFragment and TaskFragment.First I add both fragments.Then I hide the TaskFragment and show only ListCalendarFragmnet.</p> </blockquote> <pre><code> TaskFragment()fragmentTask = new TaskFragment(); ListCalendarFragment fragmentListCalendar = new ListCalendarFragment(); fragmentrans = getSupportFragmentManager().beginTransaction(); fragmentrans.add(R.id.content_frame, fragmentListCalendar); fragmentrans.add(R.id.content_frame, fragmentTask); fragmentrans.hide(fragmentTask); fragmentrans.commit(); </code></pre> <blockquote> <p>When i click the list calendar item it will call one listener that can be used to show Task Fragment as well as hide the List Calendar Fragment.</p> </blockquote> <pre><code>SherlockFragmentActivity activity = getSherlockActivity(); if (activity instanceof ListItemClickListener) { ((ListItemClickListener)activity).onListClick(); } </code></pre> <blockquote> <p>ListItemClickListener: Interface</p> </blockquote> <pre><code>public interface ListItemClickListener { public void onListClick(); } </code></pre> <p>ActionbarActivityclass implements ListItemClickListener. This functionality show the Task calendar and hide the List Calendar.</p> <pre><code>@Override public void onListClick() { fragmanager = getSupportFragmentManager(); fragmentrans = fragmanager.beginTransaction(); fragmentrans.hide(fragmentListCalendar); fragmentrans.show(fragmentTask); fragmentrans.addToBackStack(null); fragmentrans.commit(); } </code></pre> <blockquote> <p>My problem is when i back to the List Calendar by clicking the back button at that time which lifecycle method is called or how to call the user defined method in the List Calendar Fragment.Because i need to refresh the List Calendar Adapter in ListCalendar Fragment.Thanks</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload