I am new to Android app. Now I am facing an unusual problem with the "Menu" button. That's what:
I have two actions: "ActivityOne" and "ActivityTwo", where "ActivityTwo" is a child activity of ActivityOne. In both actions, I defined the options for the menu button, as shown below:
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuItem insertMenuItem = menu.add(0, INSERT_ID, 0, R.string.menu_insert); insertMenuItem.setIcon(R.drawable.ic_menu_add); MenuItem settingMenuItem = menu.add(0, SETTING_ID, 0, R.string.menu_setting); settingMenuItem.setIcon(R.drawable.ic_menu_settings); MenuItem aboutMenuItem = menu.add(0, ABOUT_ID, 0, R.string.menu_about); aboutMenuItem.setIcon(R.drawable.ic_menu_about); logPrinter.println("creating menu options..."); return true; } @Override public boolean onMenuItemSelected(int featureId, MenuItem item) { switch(item.getItemId()) { case INSERT_ID: doInsert(); return true; case SETTING_ID: return true; case ABOUT_ID: showAbout(); return true; } return super.onMenuItemSelected(featureId, item); }
In "ActivityOne", when I click the "Physical menu" button, the menu options do not appear on the bottom screen, when I checked the LogCat console, there are two warning messages that are " There is no keyboard for id 0 " and " Use the default key: /system/usr/keychars/qwerty.kcm.bin ".
BUT, in "ActivityTwo" the menu button works fine, it shows me the menu options that I defined.
Why doesn't the menu button work in "ActivityOne"? What does the msg warning mean?
android
Mellon
source share