java - Refresh TabActivity on TabHost -


i have same code:

public class mainactivity extends tabactivity  { private tabhost mtabhost;  private void setuptabhost() {     mtabhost = (tabhost) findviewbyid(android.r.id.tabhost);     mtabhost.setup(); }  @override protected void oncreate(bundle savedinstancestate) {         setcontentview(r.layout.activity_main);     // create tabs , etc...     setuptabhost();     mtabhost.gettabwidget().setdividerdrawable(r.drawable.tab_divider);     setuptab(new textview(this), "category", "category.class");     setuptab(new textview(this), "top", "top.class");     setuptab(new textview(this), "favorite", "favorite.class");  }      private void setuptab(final view view, final string tag, final string classname) {     view tabview = createtabview(mtabhost.getcontext(), tag);         tabhost tabhost = gettabhost();             tabhost.tabspec spec;                intent intent;         intent = new intent().setclass(this, category.class);             if (classname.equals("category.class")) {             intent = new intent().setclass(this, category.class);}             if (classname.equals("top.class")) {                 intent = new intent().setclass(this, top.class);}             if (classname.equals("favorite.class")) {             intent = new intent().setclass(this, favorite.class);}               tabspec setcontent = mtabhost.newtabspec(tag).setindicator(tabview).setcontent(intent); {             };             mtabhost.addtab(setcontent); }       private static view createtabview(final context context, final string text) {     view view = layoutinflater.from(context).inflate(r.layout.tabs_bg, null);     textview tv = (textview) view.findviewbyid(r.id.tabstext);     tv.settext(text);     return view; } 

i want create method on category class refres() , if tap on button on menu "refresh" method wiil refresh data , view on tabactivity.

as said in comments, tabactivity deprecated , should not used. if need support older devices, use grilledui library actionbarsherlock, dirty work of supporting older devices.


Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

How to mention the localhost in android -

php - Calling a template part from a post -