I tried that too but it only works if I am checking only 1 of the options. I can't ghet it to work with both of the options. Any ideas?
On 3/9/11, Mark Murphy <[email protected]> wrote: > There is no onOptionsngSelected() method in Android. There is no > onOptionsrsSelected() method in Android. If you want to find out when > an options menu item is clicked, you must override > onOptionsItemSelected(). > > On Wed, Mar 9, 2011 at 7:46 AM, Raghav Sood <[email protected]> wrote: >> Hi everyone, >> >> I have a menu in my game which currently has only a New Game option. I >> want it to have another option Reset Score. I wrote some code for it >> but it fails to work. >> >> My current code is: >> >> @Override >> public boolean onCreateOptionsMenu(Menu menu) { >> super.onCreateOptionsMenu(menu); >> @SuppressWarnings("unused") >> MenuItem ng = menu.add("New Game"); >> @SuppressWarnings("unused") >> MenuItem rs = menu.add("reset Scores"); >> return true; >> } >> >> public boolean onOptionsngSelected(MenuItem ng) { >> setBoard(); >> return true; >> } >> >> public boolean onOptionsrsSelected(MenuItem rs){ >> wins = 0; >> draws = 0; >> loses = 0; >> won.setText("Won: " + wins); >> lost.setText("Lost: " + loses); >> drawn.setText("Drawn: " + draws); >> setBoard(); >> return true; >> } >> >> This code compiles perfectly but when I run it on my phone none of the >> menu items work when clicked. >> >> does anyone have any idea as to why my code does not work? >> >> Thanks >> -- >> Raghav Sood >> http://www.raghavsood.com/ >> >> -- >> 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 >> > > > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > Android Training Worldwide: http://commonsware.com/training > > -- > 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 -- Raghav Sood http://www.raghavsood.com/ -- 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

