I am trying to create a activity for displaying a menu on the emulator screen, by adding this code in my AndroidViews.java file
AndroidViews.java
@Override
public boolean onCreateOptionMenu(Menu menu)
{
super.onCreateOptionsMenu(menu);
menu.add(0,1, Menu.NONE,"M1");
menu.add(0,2,Menu.NONE, "Button");
menu.add(0,3,Menu.NONE, "CheckBox");
return true;
}
i am trying to Override the onCreateOptionMenu method of activity class but whenever I have write a Override keyword with the method it will produced an error i.e.
The method onCreateOptionMenu(Menu) of type AndroidViewsActivity must override or implement a supertype method
Plz help me out as soon as possible
Your method name should be
onCreateOptionsMenu(note the extra s). If it still doesn’t work you are probably not adding the method to an Activity class.