android - Call OnResume when Back Button Pressed when using Fragments -
I add the first piece like this
Fragment Manager FM = Slider Activity. .getSupportFragmentManager (); Fragment Transaction Feet = FM BBT transactions (); Piece piece = faucet; Piece = new homefragment (); Ft.add (R.id.content_fragment, piece, "home"); Ft.addToBackStack ("home"); Ft.commit ();
and another piece
Fragment Manager FM = Slider Activity. This .getSupportFragmentManager (); Fragment Transaction Feet = FM BBT transactions (); Piece piece = faucet; Piece = new homefragment (); Ft.add (R.id.content_fragment, piece, "About"); Ft.addToBackStack ("About"); Ft.commit ();
My question is, how do I call a method of homeframement (first) if I press the back button from afraagment (seconds)
onResume ( ) Is not a problem that is causing the problem
I reply late I am posting, but I think this will be useful to others.
Unless we are using piece code from
junk ()
,onResume Call (s)
to source Destination piece at()
callbackbut in this way, we will be
onResume () <
On BackPress ()
@ Override Backup on Public Zero () {GetSupportFragmentManager (). GetFragments () .Get (GetSupportFragmentManager) GetBackStackEntryCount () - 1) .onResume (); Super.onBackPressed (); }
Note: Make sure that you have called
addToBackStack ()
withcommit ()
onResume ()
to the source piecethanks