martes, 20 de agosto de 2013

Back to previous fragment with back button

To be able to go back to the previous fragment pressing the back hardware button we have to add the fragment adding null to the backstack.

This is the resultant code:
Fragment fragment = new Fragment();
  
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().add(R.id.content_frame, fragment).addToBackStack(null).commit();
 

No hay comentarios:

Publicar un comentario