I would like to show a different snippet in TabHost for each tab. But there seems to be no easy way to do this. TabHost can only accept A. Views or B. Efforts that trigger actions when the user selects a Tab.
Going with A means that I have to initialize each fragment and load them into a container. The views that are given by TabHost. But I want these fragments to be loaded only when necessary - when the user selects their tab.
Going with B means that I load fragments into separate actions for each tab. But I would like the fragment to be able to achieve the “original” parental activity, and not just some kind of shell. The activity that contains them in the contents of the tab.
Am I missing something? Is there a way to manage fragments using TabHost correctly?
source share