I have been trying to figure out why my boolean is not changing when I press the button, when I changed it manually it worked, but it doesn't do any thing. I have tried to follow tutorials to the word but they don't work. Can anybody point out where I am going wrong?
public boolean onOptionsItemSelected(MenuItem menu)
{
MenuItem freeze = (MenuItem)findViewById(R.id.freeze);
// Handle item selection
switch (menu.getItemId()) {
case R.id.freeze:
if (freze == false){
freze = true;
} else {
freze = false;
}
return true;
case R.id.toggleVolCount:
if (toggleVol == true){
toggleVol = false;
} else {
toggleVol = true;
}
return true;
default: return super.onOptionsItemSelected(menu);
}
Thanks for all your help, when I tried the code that was suggested and it didn't work I went back and changed the menu. Previously I had made a button with an onClick to create the menu, when created the icon with code the code that I had previously written worked fine. Hope this helps someone other than me so I don't feel like so much of an idiot.}