"No keyboard for id 0"?

Posted by Mellon on Stack Overflow See other posts from Stack Overflow or by Mellon
Published on 2010-10-14T14:07:18Z Indexed on 2012/09/20 9:38 UTC
Read the original article Hit count: 199

Filed under:

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);
}

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???

© Stack Overflow or respective owner

Related posts about android