In my project I use three tab to show three activities in single screen.
Tab 1 - Map
Tab 2 - Games
Tab 3 - Imageflipper
When I select tabs in series like Map--->Ga
Use of this code in TopRatedfragment.java solve this problem:
private static View view;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (view != null) {
ViewGroup parent = (ViewGroup) view.getParent();
if (parent != null)
parent.removeView(view);
}
try {
view = inflater.inflate(R.layout.map, container, false);
} catch (InflateException e) {
/* map is already there, just return view as it is */
}
return view;
}