I went through the XML example that mark provided as that is the way I would
prefer it.
Now my code is
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.game_menu, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.ng:
setBoard();
return true;
case R.id.rs:
wins = 0;
draws = 0;
loses = 0;
won.setText("Won: " + wins);
lost.setText("Lost: " + loses);
drawn.setText("Drawn: " + draws);
setBoard();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
and the xml is:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/ng"
android:title="New Game" />
<item android:id="@+id/rs"
android:title="Reset Score" />
</menu>
Even now whenever I tap one of the options it fails to do anything.
Anything else I am doing Wrong?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en