Sending a variable between activity and fragment for managment of back button

view story

http://stackoverflow.com – I am new in android. I know maybee my question is duplicate but i can't solve my problem. I have one activity and some fragments. When clicked on a Button, i handle 10buttons in this P fragment. I want to manage back button and i use this code for management. but i don't know when i am in P fragment, how can i manage back button? how can i add my fragments to my stack??? activity public class MainActivity extends FragmentActivity { public Stack <Fragment> mFragmentStack=new Stack <Fragment>(); @Override public void onCreate(Bundle savedInstanceState) { FragmentManag (HowTos)