@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); }
@Override public boolean isConnected() { return connection.isConnected(); }