I am new in Android app. development, now I have encountered a strange
problem with the Menu button. Here is the thing:
I have two activities, "ActivityOne" and "ActivityTwo", where
"ActivityTwo" is the child Activity of "ActivityOne". In both
activity, I have defined the menu button options like following:
@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);
}
I have defined the above functions in both Activities.
In "ActivityOne", when I click the physical Menu button, there is no
menu options pop up from screen bottom, when I checked the LogCat
console, there are two warning messages, which are "No keyboard for id
0" and "Using default keyMap:/system/usr/keychars/qwerty.kcm.bin" .
BUT, in "ActivityTwo", the menu button works fine, it shows me those
menu options I defined.
Why the menu button does not work in "ActivityOne" ?? What does the
warning msg mean???
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en