Note that there are some explanatory texts on larger screens.

plurals
  1. POonMenuItemSelected never executes
    primarykey
    data
    text
    <p>When I click on a menu item I am presented with the following message in DDMS:</p> <p><strong>Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43882778</strong></p> <p>Here is most of the code from the Main class where the onMenuClick is being ignored.</p> <pre><code> public class Main extends TabActivity { public static final int ACTIVITY_CREATE = 0; private static final int ADD_ID = Menu.FIRST; private Long listId; private DbHelper mDbHelper; private Cursor mCursor; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Set the list id Bundle extras = getIntent().getExtras(); if (extras != null) { listId = extras.getLong("listId"); } // Open the database mDbHelper = new DbHelper(this); mDbHelper.open(); // Setup the tabs createTabs(); } public void createTabs() { mCursor = mDbHelper.fetchAllCategories(listId); startManagingCursor(mCursor); for (int i = 0; i [less than symbol] mCursor.getCount(); i++) { createTab( mCursor.getLong(mCursor.getColumnIndexOrThrow("_id")), mCursor.getString(mCursor.getColumnIndexOrThrow("category"))); } } public void createTab(Long categoryId, String category) { TabHost tabHost = getTabHost(); TabHost.TabSpec spec; Intent intent; intent = new Intent(); intent.putExtra("Test", category); intent.setClass(this, Categories.class); spec = tabHost.newTabSpec(category); spec.setContent(intent); spec.setIndicator(category); tabHost.addTab(spec); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, ADD_ID, 0, R.string.menu_addCategory).setIcon(R.drawable.add_grey); return true; } @Override public boolean onMenuItemSelected(int featureId, MenuItem item) { switch (item.getItemId()) { case ADD_ID: addCategory(); return true; } return super.onMenuItemSelected(featureId, item); } public void addCategory() { Intent intent = new Intent(); intent.setClass(this, CategoryEdit.class); startActivityForResult(intent, ACTIVITY_CREATE); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); switch (requestCode) { case ACTIVITY_CREATE: if (resultCode == RESULT_OK) { Bundle createExtras = intent.getExtras(); mDbHelper.addCategory(createExtras.getString("category")); } } } } </code></pre> <p>Originally my CategoryEdit.class wasn't listed in the AndroidManifest.xml file. I have added that to the manifest and still receive the same error.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload