Open the settings preferences on clicking the vertical dotted line on the upper-left corner on android app -
i want make simple settings page, went google's documentation below:
http://developer.android.com/guide/topics/ui/settings.html
created new android testing project, created preferencescreen xml, , preferencefragment class inside mainactivity class.
i want settings screen appear when press settings icon, instead shows 1 unclickable item named settings.
i know question basic, tried lot make work no results.
any please?
if want open settings menu inside action bar, shown below :

first, need define menu item inside menu.xml file activity :
<menu xmlns:android="http://schemas.android.com/apk/res/android"         xmlns:tools="http://schemas.android.com/tools" tools:context=".mainactivity">         <item android:id="@+id/action_settings" android:title="@string/action_settings"             android:orderincategory="100" android:showasaction="never" /> </menu> second, need infate menu, , events menu item click can handles using methods shown below :
@override     public boolean oncreateoptionsmenu(menu menu) {         // inflate menu; adds items action bar if present.         getmenuinflater().inflate(r.menu.menu_main, menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item) {         // handle action bar item clicks here. action bar         // automatically handle clicks on home/up button, long         // specify parent activity in androidmanifest.xml.         int id = item.getitemid();          //noinspection simplifiableifstatement         if (id == r.id.action_settings) {              // write code handle click settings menu item!              return true;         }          return super.onoptionsitemselected(item);     } 
Comments
Post a Comment