Monday, 15 March 2010

How to handle action bar in back button press in fragment in android -


I have the activity of adding one piece to one piece, it's going to be in B segment. I have different action bar icons and titles A and B pieces. A

thanks

while pressing the back button from the B piece You can set your actionbra title in your activity by the Fragment on Craft Method. In each piece, in the Create, you can call the following method,

  ((main activity) getActivity ()). SetActionBarTitle (TITLE);  

And define this method in your activity,

  Public Zero Set: Actionsbar (string title) {getActionBar (). SetDisplayShowTitleEnabled (true); GetActionBar () setTitle (title). // or getSupportActionBar (). SetTitle (title); }  

To maintain the state, you have to call it at the creator on each creative, as you replace fragment transmission which removes and adds a piece.


No comments:

Post a Comment