Skip to content Skip to sidebar Skip to footer

Android Dynamic Tab

How create dynamic tab in android?. If user want to add tab dynamically on the tabhost. How it possible?

Solution 1:

check this blog.

in this example add tab by click on button

check out http://sankarganesh-info-exchange.blogspot.com/2011/04/adding-tabs-dynamically-in-android.html

another link add tab from option menu

http://knol.google.com/k/tabs-and-tabhost#

Solution 2:

The procedure to add a tab (whether dynamically or otherwise) is similar. You need

  1. A TabHost object
  2. A TabSpec (that you could create dynamically)
  3. tabHost.addTab() method

You need to set up the target activity for this tab in the same way that you do for creating "static" tabs (via tabSpec.setContent()).

Have you tried the Android Tab Layout tutorial? What is it that is preventing you from adding the tab dynamically?

By the way, if you do not have a view in the first place, then look at TabContentFactory.

Post a Comment for "Android Dynamic Tab"