开发者

tabview - last visited tab activity

开发者 https://www.devze.com 2023-03-05 22:48 出处:网络
I have a TabActivity with 5 tabs in it and each tab has an activity defined. Irrespective of which ever t开发者_C百科ab i click, when the tabactivity screen is loaded, it always displays the first tab

I have a TabActivity with 5 tabs in it and each tab has an activity defined. Irrespective of which ever t开发者_C百科ab i click, when the tabactivity screen is loaded, it always displays the first tab. Is there a way to get the last tab visited? thanks..


Store the tab in a sharedpreference, and then when the activity hosting the tab is shown, set the tab.

@Override
    public void onTabChanged(String tabId) {

    }

or this

tabHost.getCurrentTab()

store the tab ID or index and then set it using,

 tabHost.setCurrentTab(index);
0

精彩评论

暂无评论...
验证码 换一张
取 消