2

My application has a TabActivity which contains 4 tabs. Each tab contains the corresponding activities.

The activity in the first tab is the Boot Activity. Based on some conditions I have to enable/disable the other 3 tabs from this Activity.

Can anyone help in enabling/disabling tabs from activities inside the tab?

Dori
  • 915
  • 1
  • 12
  • 20
bHaRaTh
  • 3,464
  • 4
  • 34
  • 32

2 Answers2

4

I think you are talking about hiding a tab.
Then use the following

Get TabHost from resource as

TabHost  tabHost = (TabHost)findViewById(android.R.id.tabhost);

Then runtime use this

tabHost.getTabWidget().getChildAt(3).setVisibility(View.GONE);

Supposing that you are trying to hide 4th Tab.(So 3 is used)

Tanmay Mandal
  • 39,873
  • 12
  • 51
  • 48
3
tabHost.getTabWidget().getChildAt(3).setEnabled(false)
Baz
  • 36,440
  • 11
  • 68
  • 94
Mikey
  • 4,218
  • 3
  • 25
  • 25