I am new in android and trying to create option menu, but when I press menu button menu doesn't appear.
I Create menu.xml in res/menu. the code is here
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/settings"
android:title="@string/settings_label"
android:alphabeticShortcut="@string/settings_shortcut" />
</menu>
then in main activity I override onCreateOptionMenu and onOptionItemSelected function, here are codes
public boolean onCreateOptionMenu(Menu menu)
{
//super.onCreateOptionsMenu(menu);
MenuInflater inflate=getMenuInflater();
inflate.inflate(R.menu.menu,menu);
return true;
}
public boolean onOptionItemSelected(MenuItem item)
{
switch(item.getItemId())
{
case R.id.settings:
Intent n = new Intent(SudokuActivity.this,About.class);
startActivity👎;
return true;
}
return false;
}
can someone explain what is wrong?
P.S sorry for bad english))
I Create menu.xml in res/menu. the code is here
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/settings"
android:title="@string/settings_label"
android:alphabeticShortcut="@string/settings_shortcut" />
</menu>
then in main activity I override onCreateOptionMenu and onOptionItemSelected function, here are codes
public boolean onCreateOptionMenu(Menu menu)
{
//super.onCreateOptionsMenu(menu);
MenuInflater inflate=getMenuInflater();
inflate.inflate(R.menu.menu,menu);
return true;
}
public boolean onOptionItemSelected(MenuItem item)
{
switch(item.getItemId())
{
case R.id.settings:
Intent n = new Intent(SudokuActivity.this,About.class);
startActivity👎;
return true;
}
return false;
}
can someone explain what is wrong?
P.S sorry for bad english))
and welcome to AF