private void setSelectedItem(int id) { try { int position = 0; MainMenuAdapter adapter = (MainMenuAdapter) listMenu.getAdapter(); for (int i = 0; i < adapter.getCount(); i++) { if (adapter.getItemId(i) == id) { position = i; } } listMenu.setItemChecked(position, true); } catch (Throwable e) { // protecting from weird android UI engine issues LOG.warn("Error setting slide menu item selected", e); } }