android - TabHost addFlags() not found in FragmentTabHost -


i trying refresh each tab host while clicking, tried use addflags(), not getting method.

please check code. using fragmenttabhost. possible use addflags() method in fragmenttabhost.

public class homeparentfragement extends fragmentactivity implements      view.onclicklistener {  private static final string tab_1_tag = "tab_1"; private static final string tab_2_tag = "tab_2"; private static final string tab_3_tag = "tab_3"; private static final string tab_4_tag = "tab_4"; private static final string tab_5_tag = "tab_5"; private fragmenttabhost mtabhost; view view; activity mactivity; private float startx; imagebutton btn_sidemenu; context mcontext; private linearlayout ll, ll_profile, ll_sidemenu_wallet, ll_sidemenu_postjob, ll_howitwork, ll_help, ll_logout; /**  * attention: auto-generated implement app indexing api.  * see https://g.co/appindexing/androidstudio more information.  */ private googleapiclient client;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.bottam_layout);     mtabhost = (fragmenttabhost) findviewbyid(android.r.id.tabhost);     mcontext = this;     mactivity = this;     btn_sidemenu = (imagebutton) findviewbyid(r.id.ibtn_sidemenu);     mtabhost.setup(this, getsupportfragmentmanager(), android.r.id.tabcontent);     ll = (linearlayout) findviewbyid(r.id.slider);     ll_profile = (linearlayout) findviewbyid(r.id.ll_sidemenu_profile);     ll_sidemenu_wallet = (linearlayout) findviewbyid(r.id.ll_sidemenu_wallet);     ll_sidemenu_postjob = (linearlayout) findviewbyid(r.id.ll_sidemenu_postjob);     ll_howitwork = (linearlayout) findviewbyid(r.id.ll_sidemenu_howitwork);     ll_help = (linearlayout) findviewbyid(r.id.ll_sidemenu_help);     ll_logout = (linearlayout) findviewbyid(r.id.ll_sidemenu_logout);     ll.setvisibility(view.gone);     btn_sidemenu.setonclicklistener(this);     ll_profile.setonclicklistener(this);     ll_sidemenu_wallet.setonclicklistener(this);     ll_sidemenu_postjob.setonclicklistener(this);     ll_howitwork.setonclicklistener(this);     ll_help.setonclicklistener(this);     ll_logout.setonclicklistener(this);     mtabhost.gettabwidget().setdividerdrawable(null);      mtabhost.invalidate();     mtabhost.addtab(             mtabhost.newtabspec(tab_1_tag).setindicator(gettabindicator(mtabhost.getcontext(), "", getresources().getdrawable(r.drawable.home_tab_1))),             hometabadvancesearchfragments.class, null);     mtabhost.addtab(             mtabhost.newtabspec(tab_2_tag).setindicator(gettabindicator(mtabhost.getcontext(), "", getresources().getdrawable(r.drawable.home_tab_2))),             hometabfavouritefragment.class, null);     mtabhost.addtab(             mtabhost.newtabspec(tab_3_tag).setindicator("", getresources().getdrawable(r.drawable.hometab3_normal)),             hometabbasicsearchfragment.class, null);     mtabhost.addtab(             mtabhost.newtabspec(tab_4_tag).setindicator(gettabindicator(mtabhost.getcontext(), "", getresources().getdrawable(r.drawable.home_tab_4))),             hometabmessagefragment.class, null);     mtabhost.addtab(             mtabhost.newtabspec(tab_5_tag).setindicator(gettabindicator(mtabhost.getcontext(), "", getresources().getdrawable(r.drawable.home_tab_5))),             listjobparentfragment.class, null);       // inflating color first time.     (int = 0; < mtabhost.gettabwidget().getchildcount(); i++) {         mtabhost.gettabwidget().getchildat(i)                 .setbackgroundcolor(color.parsecolor("#ffffff"));     }      mtabhost.gettabwidget().getchildat(mtabhost.getcurrenttab())             .setbackgroundcolor(color.parsecolor("#ffffff"));     // ============== end of color inflation ==================      mtabhost.setontabchangedlistener(new tabhost.ontabchangelistener() {          @override         public void ontabchanged(string tabid) {             ll.setvisibility(view.gone);              // inflating color when tab selected.             (int = 0; < mtabhost.gettabwidget().getchildcount(); i++) {                 mtabhost.gettabwidget().getchildat(i)                         .setbackgroundcolor(color.parsecolor("#ffffff"));             }              mtabhost.gettabwidget().getchildat(mtabhost.getcurrenttab())                     .setbackgroundcolor(color.parsecolor("#ffffff"));             // ============== end of color inflation ==================          }     });      (int = 0; < mtabhost.gettabwidget().getchildcount(); i++) {         final textview tv = (textview) mtabhost.gettabwidget()                 .getchildat(i).findviewbyid(android.r.id.title);          if (tv == null)             continue;         else             tv.settextsize(8);      }       // attention: auto-generated implement app indexing api.     // see https://g.co/appindexing/androidstudio more information.     client = new googleapiclient.builder(this).addapi(appindex.api).build(); }  private view gettabindicator(context context, string string, drawable drawable) {     view view = layoutinflater.from(context).inflate(r.layout.tab_layout, null);     imageview iv = (imageview) view.findviewbyid(r.id.imageviewtabview);     iv.setimagedrawable(drawable);      return view; }  @override public void onclick(view v) {     switch (v.getid()) {         case r.id.ibtn_sidemenu:             ll.setvisibility(view.visible);              break;         case r.id.ll_sidemenu_profile:             ll.setvisibility(view.gone);              fragment newfragment = new sidemenuparentfragment();             android.support.v4.app.fragmenttransaction transaction = getsupportfragmentmanager().begintransaction();             transaction.replace(android.r.id.tabcontent, newfragment);             transaction.addtobackstack(null);             transaction.commit();              break;         case r.id.ll_sidemenu_wallet:             ll.setvisibility(view.gone);              break;          case r.id.ll_sidemenu_postjob:             ll.setvisibility(view.gone);             fragment newfragmentpostjob = new postjobparentfragment();             android.support.v4.app.fragmenttransaction transactionpostjob = getsupportfragmentmanager().begintransaction();             transactionpostjob.replace(android.r.id.tabcontent, newfragmentpostjob);             transactionpostjob.addtobackstack(null);             transactionpostjob.commit();               break;         case r.id.ll_sidemenu_howitwork:             ll.setvisibility(view.gone);              break;         case r.id.ll_sidemenu_help:             ll.setvisibility(view.gone);              break;         case r.id.ll_sidemenu_logout:             ll.setvisibility(view.gone);             utils.removesharedpreferences(mcontext, "group_id");             intent = new intent(getapplicationcontext(), menuactivity.class);             startactivity(i);             finish();              break;     }   }    @override public void onbackpressed() {     utils.exitapp(mactivity);  }  } 

tabhost.addtab(tabhost.newtabspec("tab2")     .setindicator("second text")     .setcontent(       new intent(this, class2.class)           .addflags(intent.flag_activity_clear_top)     )); 

this code working @ end :

 mtabhost.addtab(                 mtabhost.newtabspec(tab_1_tag).setindicator(gettabindicator(mtabhost.getcontext(), "", getresources().getdrawable(r.drawable.home_tab_1))),                 hometabadvancesearchfragments.class, null).setcontent(new intent(this, class2.class)                         .addflags(intent.flag_activity_clear_top)         )); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -