Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.46 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How do I add unique content to each tab in an Android app
  2. TabHost host = findViewById(R.id.my_tabhost);
  3. boolean boo = true; //Variable that will decide what tabs to add
  4. host.setup(); //Need to call before adding tabs
  5. if (boo)
  6.     host.addTab(host.newTabSpec("Hello").setIndicator("Hello").setContent(new Intent(this, HelloActivity.class)));
  7. else
  8.     host.addTab(host.newTabSpec("Goodbye").setIndicator("Goodbye").setContent(new Intent(this, GoodbyeActivity.class));