My select_screen_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/home_menu"
android:icon="@drawable/home_tab"
android:title="Home" />
<item android:id="@+id/submit_report"
android:icon="@drawable/submit_tab"
android:title="Submit a Report" />
<item android:id="@+id/search_list"
android:icon="@drawable/search_icon"
android:title="Search the List" />
</menu>
and my activity class used it as
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.select_screen_menu, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.home_menu: {
Static.backwardTo(User.viewflipper,ConstandsUsed.USER_SELECT_SCREEN);
return true;
}
case R.id.submit_report:
Static.backwardTo(User.viewflipper, User.sumitAReport_PAGE);
return true;
case R.id.search_list:
Static.backwardTo(User.viewflipper, User.searchTheList_PAGE);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
i have used the following code to identify the back button
public boolean onKeyDown(int keyCode, KeyEvent event) {
---
---
}
this two are not working together. The menu will work only when this onkeydown function is removed. Is there any way to use this together Do I need to do any other things?
Please help me, thanks