Automatically select a default tab android

1

It turns out that in my app I have 4 tabs, of which one of them is the profile of the person. I would like that when the user opens the activity that contains these 4 tabs, redirect only to the tab of the profile and not open automatically the first tab (from left to right) Is it possible? I hope I was clear. Thank you very much

    
asked by Nicolas Schmidt 14.07.2016 в 22:00
source

2 answers

1

I solved it, we must add the following, where tab number is the index number that starts from 0 :

tabhost.setcurrentTab(número del tab);
    
answered by 14.07.2016 в 23:56
0

You must specify that class of tabs you are using, they may be from a tabhost or from a actionbar tab, to define the default tab in a tabhost is used the method setCurrentTab ()

myTab.setCurrenTab(n);

Remember that the index starts from 0.

To get the default tab you can get it by getCurrentTab ()

    
answered by 15.07.2016 в 14:32