I've Googled and come up with no code on how to manipulate what the settings button does, or what is brought up when the settings touch button on the phone is pressed.
Here is a screenshot of what I mean:
At the bottom, you can see that it says settings, but when I click on it, nothing happens. I want to change what happens when it is clicked.
Also, I want to be able to change what is brought up (the settings option in the screenshot is what's brought up) when the settings button on the actual phone is pressed. eg. on the S3, it's the touch button at the bottom left of your device.
Can anyone link me to a resource, or write some sample code for how to do both, or even one of the things I want to do?
You need to override your Activity's
onOptionsItemSelected(...)
method.Do it like this:
Check the id of the options item (e.g. settings) and do specific stuff inside the if.
In order to add more items or manipulate the Id, take a look at your projects "menu" folder and the .xml file inside it.
Here the .xml file of my main menu:
And how it looks inside:
(you can manipulate this file and add more actions to it that will show up in the menu)
In this case my menu would have 3 Actions, and you should check for them inside your
onOptionsItemSelected(...)
method like that:... or use switch-case. For a more detailed explanation, you can also have a look at this tutorial: