Skip to content Skip to sidebar Skip to footer

New Layouts In Tabhost

I'm using tabHost in my application but in one of the views (corresponding to one of the tabs) I have a button that have to take me to another activity and then another layout. The

Solution 1:

You can use Fragments instead of activites inside Tab. And on click of button, you can replace existing fragment with a new one like this :

finalFragmentTransactionft= getFragmentManager().beginTransaction();
    ft.replace(R.id.realtabcontent,newFrag, "New Fragment"); 
    ft.addToBackStack(null);
    ft.commit(); 

In ft.replace1st parameter is the frameLayout to which fragment is to be attached, second is the fragment class object to be instatiated and third is the tag name.

Post a Comment for "New Layouts In Tabhost"