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 () callback

but 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 () with commit ()

onResume () to the source piece

thanks


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -