I have many fragments in an activity. I move to some activity from one of the fragments. There are two cases. If I press hardware back button, I move back to the fragment fr
In the switch statement, change
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
to
case android.R.id.home:
onBackPressed();
return true;
You can call the method onBackPressed();
of the Activity to give you the ability to back button just like the hardware back button.
if you are in fragment call getActivity().onBackPressed()