I have been trying to use a tab view inside a fragment,but some errors are coming while accessing it through the navigation bar.while accessing it for the first time,i can f
Try this way
public class HomeFragment extends Fragment {
ExpandableListAdapter listAdapter;
ExpandableListView expListView;
List listDataHeader;
HashMap> listDataChild;
private FragmentTabHost tabHost;
public HomeFragment(){}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
tabHost = new FragmentTabHost(getActivity());
tabHost.setup(getActivity(), getChildFragmentManager(), R.layout.my_parent_fragment);
Bundle arg1 = new Bundle();
arg1.putInt("Arg for Frag1", 1);
tabHost.addTab(tabHost.newTabSpec("Tab1").setIndicator("Tab1")),
FragmentA.class, arg1);
Bundle arg2 = new Bundle();
arg2.putInt("Arg for Frag2", 2);
tabHost.addTab(tabHost.newTabSpec("Tab2").setIndicator("Tab 2")),
FragmentB.class, arg2);
return tabHost;
}
XML