Skip to content

Instantly share code, notes, and snippets.

@devrath
Created November 26, 2014 10:47
Show Gist options
  • Select an option

  • Save devrath/51506fc101d6473eae50 to your computer and use it in GitHub Desktop.

Select an option

Save devrath/51506fc101d6473eae50 to your computer and use it in GitHub Desktop.
Android Maps ... Code to go back and forth in the tabs so error won't be raised
@Override
public void onDestroyView ()
{
// This is necessary so that there is no error raised when you navigate back and forth from the mapfragment
try{
MapFragment fragment = ((MapFragment) getFragmentManager().findFragmentById(R.id.map));
FragmentTransaction ft = getActivity().getFragmentManager().beginTransaction();
ft.remove(fragment);
ft.commit();
}catch(Exception e){
}
super.onDestroyView();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment