Display Option menu(Overflow icon) icon in ActionBar in devices like Samsung S4 & Xolo.
In android when we are dealing with Option menu then the worst part is that in some devices the option menu Button is invisible from action-bar like (Samsung , XOLO devices). This is because Mobile devices has a hardware button for option menu.
to solve this issue There is one tricky approach.
1. Create Class file in your application which extends Application class.
to solve this issue There is one tricky approach.
1. Create Class file in your application which extends Application class.
2. Override onCreate() of Application class.
3. write below code of under onCreate()try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception ex) { ex.printStackTrace(); }
4. Open Android.Manifest.xml.
5. Add android:name="MyApplication" (name of your class name which extends Application).
See the images below. You can download the source code from Here. happy blogging.. :D
Comments
Post a Comment