java - Changing a tabs content inside a tab -


i'm having problems tabs in android.

first of create tabs this:

    tabhost = gettabhost();     search = tabhost.newtabspec("search").setindicator("search").setcontent(new intent(this,search.class));     mealplan = tabhost.newtabspec("mealplan").setindicator("mealplan").setcontent(new intent(this,search.class));     shoppinglist = tabhost.newtabspec("shoppinglist").setindicator("shoppinglist").setcontent(new intent(this,search.class));     settings = tabhost.newtabspec("settings").setindicator("settings").setcontent(new intent(this,newuser.class));      tabhost.addtab(search);     tabhost.addtab(mealplan);     tabhost.addtab(shoppinglist);     tabhost.addtab(settings); 

now want have ability change content of tab inside tab. example if im in search tab (the default start-tab) want programically change content of search instant effect. earlier starting new activities activitygroup ended giving me stackoverflow time. assume because couldn't use finish() because close whole program.

so said, new approach changing/starting activity inside tab call activity holding tabs, , make class change content of tab. how?

i've tried using setcontent, effect isn't instant , kinda overlaps default content tab. can me? let me know if u want other code.

thanks in advance.

public class l9_taboacto extends activity {     tabspec search,mealplan,shoppinglist,settings;       tabhost tabs;     @override     public void oncreate(bundle icicle) {         super.oncreate(icicle);         setcontentview(r.layout.main);          tabs=(tabhost)findviewbyid(r.id.tabhost);         tabs.setup();         search = tabs.newtabspec("search").setindicator("search").setcontent(new intent(this,search.class));         mealplan = tabs.newtabspec("mealplan").setindicator("mealplan").setcontent(new intent(this,search.class));         shoppinglist = tabs.newtabspec("shoppinglist").setindicator("shoppinglist").setcontent(new intent(this,search.class));         settings = tabs.newtabspec("settings").setindicator("settings").setcontent(new intent(this,newuser.class));          tabs.addtab(search);         tabs.addtab(mealplan);         tabs.addtab(shoppinglist);         tabs.addtab(settings);      }    } 

good luck,


im sorry, looks understood problem in wrong way ,here can find solution arranging launching intents :

http://united-coders.com/nico-heid/android-viewflipper-within-tabhost-for-tabs-with-different-views-and-better-memory

mohammed,


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -