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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to