コード例 #1
0
 @Override
 public void onPrepareOptionsMenu(Menu menu) {
   if (menuEnabled && !connection.isConnected()) {
     String menuResetEntry = getString(R.string.action_reconnect_receiver, ip);
     boolean first = true;
     for (int i = 0; i < menu.size(); i++) {
       if (menu.getItem(i).getTitle().equals(menuResetEntry)) {
         first = false;
       }
     }
     if (first) {
       menuResetItem = menu.add(Menu.NONE, Menu.NONE, MENU_ORDER, menuResetEntry);
     }
   }
   super.onPrepareOptionsMenu(menu);
 }
コード例 #2
0
 @Override
 public boolean isConnected() {
   return connection.isConnected();
 }