@Override public boolean onMenuItemSelected(int featureId, MenuItem item) { switch (item.getItemId()) { case ADD_NEW_FRIEND_ID: { Intent i = new Intent(FriendList.this, SearchFriend.class); startActivity(i); return true; } case EXIT_APP_ID: { imService.exit(); finish(); return true; } } return super.onMenuItemSelected(featureId, item); }