android - Overflow dots not appearing on tablet -


for reason overflow dots not appear on tablet master detail application when select list item yet on handset. i'm not sure why occurring despite using necessary code. there code missing or shouldn't there?

mainactivity.java public class mainactivity extends actionbaractivity {

/**  * whether or not activity in two-pane mode, i.e. running on tablet  * device.  */ private boolean mtwopane;  @override protected void oncreate(bundle savedinstancestate) {      // force show actionbar 'overflow' button on devices hardware menu button     try {         viewconfiguration config = viewconfiguration.get(this);         field menukeyfield = viewconfiguration.class.getdeclaredfield("shaspermanentmenukey");         if (menukeyfield != null) {             menukeyfield.setaccessible(true);             menukeyfield.setboolean(config, false);         }     }     catch (exception e) {         e.printstacktrace();     }      super.oncreate(savedinstancestate);      setcontentview(r.layout.activity_main);      actionbar actionbar = getsupportactionbar();     actionbar.settitle(getresources().getstring(r.string.greeting));      fragmentmainlist newfragment = new fragmentmainlist();     fragmenttransaction transaction = getsupportfragmentmanager().begintransaction();     transaction.replace(r.id.master_container, newfragment);     transaction.commit();      if (findviewbyid(r.id.detail_container) != null) {         mtwopane = true;     } } 

}

activity class

public class wcbankactivity extends actionbaractivity {      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.fragment_wc_bank);          if (savedinstancestate == null) {             fragmentwcbank newfragment = new fragmentwcbank();             fragmenttransaction transaction = this.getsupportfragmentmanager().begintransaction();             transaction.replace(r.id.detail_container, newfragment);             transaction.commit();         }          actionbar actionbar = getsupportactionbar();      }      @override     public boolean oncreateoptionsmenu(menu menu) {         getmenuinflater().inflate(r.menu.menu_wc_bank, menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item) {         if (item.getitemid() == android.r.id.home) {             final intent intent = navutils.getparentactivityintent(this);             intent.addflags(intent.flag_activity_no_animation);             navutils.navigateupto(this, intent);             return true;         }         return super.onoptionsitemselected(item);     } } 

fragment class

public class fragmentwcbank extends android.support.v4.app.fragment {      public fragmentwcbank() {         // required empty constructor     }      public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) {         view v = inflater.inflate(r.layout.fragment_wc_bank, container, false);          super.oncreate(savedinstancestate);         sethasoptionsmenu(true);          return v;     }      @override     public void onactivitycreated(bundle savedinstancestate) {         view v = getview();          super.onactivitycreated(savedinstancestate);     }      @override     public void oncreateoptionsmenu(menu menu, menuinflater inflater) {         super.oncreateoptionsmenu(menu, inflater);     }      @override     public boolean onoptionsitemselected(menuitem item) {         if (item.getitemid() == android.r.id.home) {             final intent intent = navutils.getparentactivityintent(getactivity());             intent.addflags(intent.flag_activity_no_animation);             navutils.navigateupto(getactivity(), intent);             return true;         }          int id = item.getitemid();          if (id == r.id.action_other_lines) {         }          return super.onoptionsitemselected(item);     } } 

enter image description here enter image description here

the dots shown devices don't have hardware menu button. devices hardware menu button no overflow dots shown since tapping on menu button same. more here

edit

if reason want show it, can add below code in application.oncreate() or main (launcher) activity oncreate()

// force show actionbar 'overflow' button on devices hardware menu button try {     viewconfiguration config = viewconfiguration.get(this);     field menukeyfield = viewconfiguration.class.getdeclaredfield("shaspermanentmenukey");     if (menukeyfield != null) {         menukeyfield.setaccessible(true);         menukeyfield.setboolean(config, false);     } } catch (exception e) {     e.printstacktrace(); } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -