Biribu
Biribu

Reputation: 3823

Show another tab than first one at starting android

Is it possible display one tab or another in android dynamically?

I am trying to make an app with 3 tabs but sometimes is possible that one or two tabs will not have content (not buttons or data in activities) so I want just show the activity which has data or one of both with it.

I want to keep the possibility that the user navigate to tabs without content but I want to show firstly the tab with it.

I am following this tutorial: http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/ to do the tabs. I mean, if you need my code to make any modification or add anything. For the moment I just want to have an example to show it and after that start adding my code, which already works in an older app.

Upvotes: 0

Views: 53

Answers (1)

Abhishek Agarwal
Abhishek Agarwal

Reputation: 1897

You can move to the tab by using

                viewPager.setCurrentItem(item_position);
  getActionBar().setSelectedNavigationItem(item_position);

Upvotes: 1

Related Questions