0

I am using this to add a Fragment to the Activity:

FragmentTransaction t = this.getSupportFragmentManager()
        .beginTransaction();
t.add(R.id.frame, new FeedListFragment());
t.commit();

This fragment is a SideMenu. There is an Image in this Fragment which i want to check whether it is changed and replace it with new image. I what this check in onPause();

But the fragment's onPause or onResume are not triggered as expected.

Fragment onResume() & onPause() is not called on backstack

Even i asked a question on sof regarding this, but could not get an Answer.

But the actual question is:

How can i send some data/bundle to this fragment in the onResume() of the MainActivity and Track that in the Fragment Added?

Thank You

Community
  • 1
  • 1
Archie.bpgc
  • 23,812
  • 38
  • 150
  • 226

1 Answers1

0

From fragment, use onAttach() of fragment, to register parent activity with fragment. Once Fragment has a handle on Activity, it can call its methods.

From Activity, use Fragment manager to find the fragment by its tag name, and call its methods.

S.D.
  • 29,290
  • 3
  • 79
  • 130