How to determine when a fragment is visible to the user
<p>my app has one activity called MainActivity.</p>

<p>MainActivity loads 3 fragments, all added to back stack. The first one is automatically opened and is ListFragment. If I click on an item in ListFragment the DetailFragment is created. Inside DetailF I can click the edit button and EditFragment is opened. So the backstack is:</p>

<ul>
<li>ListFragment</li>
<li>DetailFragment</li>
<li>EditFragment</li>
</ul>

<p>Inside EditF one can change informations about the object that is being displayed in DetailFragment. Inside the onPause of EditF I save the chanegs</p>

<pre><code>@Override
public void onPause() {
    super.onPause();        
    mTask.setTitle(mTitleEditText.getText().toString());
    mTask.setSummary(mSummaryEditText.getText().toString());

}
</code></pre>

<p>So when I hit the back button the chanegs are successfully saved (I see that from the logs). So DetailF appears but the changes are not shown: that's becuase DetailF has been previously loaded with the beggining data. Since the onresume doesn't get called when DetailF is visible I can't tell the fragment to update the data.</p>

<p>If I hit the back button another time I go back to the ListF and the updated data is also not shown.</p>

<p>This is how I create the fragemnts:</p>

<p>in MainActivity.java</p>

<pre><code>private void launchListFragment(){

    getSupportFragmentManager().popBackStack ("detail", FragmentManager.POP_BACK_STACK_INCLUSIVE);

    Fragment newDetail = ListFragment.newInstance();
    getSupportFragmentManager().beginTransaction()
            .replace(R.id.fragment_container, newDetail, "LIST_F_TAG")
            .commit();
}
</code></pre>

<p>in ListFragment:</p>

<pre><code>Task taskToSend = mViewAdapter.getList().get(adapterPosition);

        if(getActivity() != null){
            Fragment newDetail = DetailFragment.newInstance(taskToSend);
            getActivity().getSupportFragmentManager().beginTransaction()
                    .add(R.id.fragment_container, newDetail)
                    .addToBackStack("detail")
                    .commit();
        }
</code></pre>

<p>in DetailFragment:</p>

<pre><code>private void launchEditFragment(Task task){
    if(getActivity() != null){
        Fragment newDetail = EditFragment.newInstance(task);
        getActivity().getSupportFragmentManager().beginTransaction()
                .add(R.id.fragment_container, newDetail)
                .addToBackStack("edit")
                .commit();
    }
}
</code></pre>

<p>I want that once I update the mTask data in EditFragment all other fragments display the updated data. Thanks.</p>