I am loading an activity from my fragment. If I press the back button on the device, it goes back to the Gridfragment (as expected).
But, if I click the action bar back arrow, it goes back to the mainActivity hosted fragment = HomeFragment and not the Gridfragment.
From HomeFragment - ( default fragment)
Fragment f = GridFragment.newInstance(GridFragment.TAG_bundlePhotosList);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, f).addToBackStack(null).commit();
Fragment Grid:
Intent i = new Intent(getActivity(), ImagePreviewActivity.class);
i.putExtra("from_grid", "from_grid");
tartActivity(i);
ImagePreviewActivity :
//Display back arrow
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(ImagePreviewActivity);