Source:
<code>public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); if (makingShortcut) return true; sortcolor = menu.add(R.string.list_menu_sortcolor); sortcolor.setIcon(android.R.drawable.ic_menu_share); sortcolor.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { sortedByColor = true; updateList(); return true; } }); sortlast = menu.add(R.string.list_menu_sortname); sortlast.setIcon(android.R.drawable.ic_menu_share); sortlast.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { sortedByColor = false; updateList(); return true; } }); MenuItem keys = menu.add(R.string.list_menu_pubkeys); keys.setIcon(android.R.drawable.ic_lock_lock); keys.setIntent(new Intent(HostListActivity.this, PubkeyListActivity.class)); MenuItem colors = menu.add(R.string.title_colors); colors.setIcon(android.R.drawable.ic_menu_slideshow); colors.setIntent(new Intent(HostListActivity.this, ColorsActivity.class)); disconnectall = menu.add(R.string.list_menu_disconnect); disconnectall.setIcon(android.R.drawable.ic_menu_delete); final HostListActivity self = this; disconnectall.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { <START> self.disconnectAll(); <END> return false; } }); MenuItem settings = menu.add(R.string.list_menu_settings); settings.setIcon(android.R.drawable.ic_menu_preferences); settings.setIntent(new Intent(HostListActivity.this, SettingsActivity.class)); MenuItem help = menu.add(R.string.title_help); help.setIcon(android.R.drawable.ic_menu_help); help.setIntent(new Intent(HostListActivity.this, HelpActivity.class)); return true; }</code><technical_language>call disconnectAll(). need for stuff. calls updateList in handlers</technical_language>

Target:
public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); if (makingShortcut) return true; sortcolor = menu.add(R.string.list_menu_sortcolor); sortcolor.setIcon(android.R.drawable.ic_menu_share); sortcolor.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { sortedByColor = true; updateList(); return true; } }); sortlast = menu.add(R.string.list_menu_sortname); sortlast.setIcon(android.R.drawable.ic_menu_share); sortlast.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { sortedByColor = false; updateList(); return true; } }); MenuItem keys = menu.add(R.string.list_menu_pubkeys); keys.setIcon(android.R.drawable.ic_lock_lock); keys.setIntent(new Intent(HostListActivity.this, PubkeyListActivity.class)); MenuItem colors = menu.add(R.string.title_colors); colors.setIcon(android.R.drawable.ic_menu_slideshow); colors.setIntent(new Intent(HostListActivity.this, ColorsActivity.class)); disconnectall = menu.add(R.string.list_menu_disconnect); disconnectall.setIcon(android.R.drawable.ic_menu_delete); disconnectall.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { disconnectAll(); return false; } }); MenuItem settings = menu.add(R.string.list_menu_settings); settings.setIcon(android.R.drawable.ic_menu_preferences); settings.setIntent(new Intent(HostListActivity.this, SettingsActivity.class)); MenuItem help = menu.add(R.string.title_help); help.setIcon(android.R.drawable.ic_menu_help); help.setIntent(new Intent(HostListActivity.this, HelpActivity.class)); return true; }