// the meat of switching the above fragment private void switchFragment(SherlockFragment fragment) { if (getActivity() == null) return; if (getActivity() instanceof MainActivity) { MainActivity ra = (MainActivity) getActivity(); ra.switchContent(fragment); } }