I have an app in the making, and have a Preferences activity which allows the user to choose settings for the app.
What I need help with is choosing how the preference activity will be accessed by the user. Some tutorials actually have a button in the main activity labeled, for example, “preferences” which would allow the user to visit that activity.
Others (the way I have it currently) just rely on the user clicking the menu button on their phone. I read that some phones do not have a menu button anymore, and the Android team is trying to get rid of a physical navigation button requirements.
So I am a little confused, what is the general consensus on this topic? Thank you.
EDIT: Here is my current menu creation code
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(Menu.NONE, 0, 0, "Settings");
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case 0:
startActivity(new Intent(this, Preferences.class));
return true;
}
return false;
}
Use the “menu button” approach. Typically, in English, the button should be called “Settings”, not “Preferences”, even though it manages Preferences. Silly, I know.
Regarding phones with no menu buttons:
The only phones that don’t them run Android 4.0 or higher. As long as your target Android 3.0 or higher in your project build, and properly create the menu item (I’ll provide a snippet if you need to know how), Android will detect that there’s no hardware menu button and add an “Overflow” menu to the Action Bar.
Edit: Here’s the snippet:
The overflow menu looks like three dots, and is like a “more…” option for the Action Bar. The Android Design Guidelines say you should always put your Settings option in the overflow menu.
Hope that clears it up, anything else, feel free to ask.