Java Code Examples for android.view.MenuItem

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project ActionBarCompat, under directory /ActionBarCompat/src/sk/m217/actionbarcompat/.

Source file: SimpleMenu.java

  18 
vote

private static int findInsertIndex(ArrayList<? extends MenuItem> items,int order){
  for (int i=items.size() - 1; i >= 0; i--) {
    MenuItem item=items.get(i);
    if (item.getOrder() <= order) {
      return i + 1;
    }
  }
  return 0;
}
 

Example 2

From project and-bible, under directory /AndBible/src/net/bible/android/control/backup/.

Source file: BackupControl.java

  18 
vote

public void updateOptionsMenu(Menu menu){
  MenuItem restoreMenuItem=menu.findItem(R.id.restore);
  if (restoreMenuItem != null) {
    restoreMenuItem.setEnabled(isBackupFile());
  }
}
 

Example 3

From project android-context, under directory /src/edu/fsu/cs/contextprovider/map/.

Source file: AddPlaceMapActivity.java

  18 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  int base=Menu.FIRST;
  MenuItem item1=menu.add(base,base,base,"Map");
  MenuItem item2=menu.add(base,base + 1,base + 1,"Satellite");
  MenuItem item3=menu.add(base,base + 2,base + 2,"My Location");
  MenuItem item4=menu.add(base,base + 3,base + 3,"Return");
  item1.setIcon(android.R.drawable.ic_menu_gallery);
  item2.setIcon(android.R.drawable.ic_menu_mapmode);
  item3.setIcon(android.R.drawable.ic_menu_mylocation);
  item4.setIcon(android.R.drawable.ic_menu_close_clear_cancel);
  return true;
}
 

Example 4

From project Android-FFXIEQ, under directory /ffxieq/src/com/github/kanata3249/ffxieq/android/.

Source file: AugmentSelectorActivity.java

  18 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.augmentselector_context,menu);
  MenuItem item=menu.findItem(R.id.DeleteAugment);
  if (item != null) {
    item.setEnabled(mLongClickingItemId != mAugID);
  }
}
 

Example 5

From project android-pulltorefresh, under directory /sample/src/com/handmark/pulltorefresh/samples/.

Source file: PullToRefreshListActivity.java

  18 
vote

@Override public boolean onPrepareOptionsMenu(Menu menu){
  MenuItem disableItem=menu.findItem(MENU_DISABLE_SCROLL);
  disableItem.setTitle(mPullRefreshListView.isDisableScrollingWhileRefreshing() ? "Enable Scrolling while Refreshing" : "Disable Scrolling while Refreshing");
  MenuItem setModeItem=menu.findItem(MENU_SET_MODE);
  setModeItem.setTitle(mPullRefreshListView.getMode() == Mode.BOTH ? "Change to MODE_PULL_DOWN" : "Change to MODE_PULL_BOTH");
  return super.onPrepareOptionsMenu(menu);
}
 

Example 6

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/core/activity/.

Source file: TopLevelActivity.java

  18 
vote

@Override public boolean onPrepareOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  MenuItem item=menu.findItem(MenuUtils.SYNC_ID);
  if (item != null) {
    item.setVisible(Preferences.validateTracksSettings(this));
  }
  return true;
}
 

Example 7

From project Android-Terminal-Emulator, under directory /src/jackpal/androidterm/.

Source file: Term.java

  17 
vote

@Override public boolean onPrepareOptionsMenu(Menu menu){
  MenuItem wakeLockItem=menu.findItem(R.id.menu_toggle_wakelock);
  MenuItem wifiLockItem=menu.findItem(R.id.menu_toggle_wifilock);
  if (mWakeLock.isHeld()) {
    wakeLockItem.setTitle(R.string.disable_wakelock);
  }
 else {
    wakeLockItem.setTitle(R.string.enable_wakelock);
  }
  if (mWifiLock.isHeld()) {
    wifiLockItem.setTitle(R.string.disable_wifilock);
  }
 else {
    wifiLockItem.setTitle(R.string.enable_wifilock);
  }
  return super.onPrepareOptionsMenu(menu);
}
 

Example 8

From project abalone-android, under directory /src/com/bytopia/abalone/.

Source file: MainMenuActivity.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
  super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case R.id.rules_menu:
    Dialog dialog=new Dialog(this);
  dialog.setContentView(R.layout.rules);
dialog.setTitle(getString(R.string.rules_title));
dialog.show();
break;
case R.id.preferences_menu:
Intent preferencesIntent=new Intent("com.bytopia.abalone.PREFERENCES");
startActivity(preferencesIntent);
break;
}
return true;
}
 

Example 9

From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.

Source file: AAMain.java

  15 
vote

/** 
 * Starts the settings activity when user presses "Settings"
 * @param menuItem - Item selected from the options menu
 */
@Override public boolean onOptionsItemSelected(MenuItem item){
  Intent activity=new Intent();
  if (item.getTitle().equals(getString(R.string.settings))) {
    activity.setClass(this,AASettings.class);
    this.startActivity(activity);
    return true;
  }
 else   return false;
}
 

Example 10

From project AChartEngine, under directory /client/src/org/achartengine/demo/.

Source file: Demo.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_about:
{
      Uri flickr_destination=Uri.parse(GOOGLE_CODE_URL);
      startActivity(new Intent(Intent.ACTION_VIEW,flickr_destination));
      return true;
    }
}
return super.onOptionsItemSelected(item);
}
 

Example 11

From project ActionBarSherlock, under directory /samples/fragments/src/com/actionbarsherlock/sample/fragments/.

Source file: FragmentContextMenuSupport.java

  15 
vote

@Override public boolean onContextItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.a_item:
    Log.i("ContextMenu","Item 1a was chosen");
  return true;
case R.id.b_item:
Log.i("ContextMenu","Item 1b was chosen");
return true;
}
return super.onContextItemSelected(item);
}
 

Example 12

From project adg-android, under directory /src/com/analysedesgeeks/android/.

Source file: AbstractPodcastActivity.java

  15 
vote

@Override public boolean onOptionsItemSelected(final com.actionbarsherlock.view.MenuItem item){
switch (item.getItemId()) {
case MENU_INFO:
    ActivityController.showInfoActivity(this);
  return true;
case android.R.id.home:
ActivityController.showMainActivity(this);
return true;
default :
return super.onOptionsItemSelected(item);
}
}
 

Example 13

From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/activity/menu/.

Source file: MainMenu.java

  15 
vote

public boolean handleClick(Activity activity,MenuItem item){
switch (item.getItemId()) {
case R.id.aircasting:
    if (sessionManager.isSessionSaved()) {
      sessionManager.discardSession();
    }
  Intent intent=new Intent(context,SoundTraceActivity.class);
intent.putExtra("startingAircasting",true);
activity.startActivity(intent);
break;
case R.id.sessions:
activity.startActivity(new Intent(context,SessionsActivity.class));
break;
case R.id.settings:
activity.startActivity(new Intent(context,SettingsActivity.class));
break;
case R.id.about:
activity.startActivity(new Intent(context,AboutActivity.class));
break;
}
return true;
}
 

Example 14

From project aksunai, under directory /src/org/androidnerds/app/aksunai/.

Source file: Aksunai.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case NEW_SERVER:
    newServer();
  break;
case SETTINGS:
startActivity(new Intent(this,Preferences.class));
break;
}
return super.onOptionsItemSelected(item);
}
 

Example 15

From project AlarmApp-Android, under directory /src/org/alarmapp/activities/.

Source file: MainActivity.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.log_out:
    new Thread(onLogoutClick).start();
  IntentUtil.displayLoginActivity(this);
return true;
default :
return super.onOptionsItemSelected(item);
}
}
 

Example 16

From project Alerte-voirie-android, under directory /src/com/fabernovel/alertevoirie/.

Source file: HomeActivity.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case MENU_CREDITS:
    Intent i=new Intent(this,CreditsActivity.class);
  startActivity(i);
break;
default :
return super.onOptionsItemSelected(item);
}
return true;
}
 

Example 17

From project alljoyn_java, under directory /samples/android/contacts/ContactsClient/src/org/alljoyn/bus/samples/contacts_client/.

Source file: ContactsClient.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.quit:
    finish();
  return true;
default :
return super.onOptionsItemSelected(item);
}
}
 

Example 18

From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/.

Source file: EditPreferencesActivity.java

  15 
vote

public boolean onOptionsItemSelected(MenuItem item){
  super.onOptionsItemSelected(item);
  Log.d(TAG,"onOptionsItemSelected");
switch (item.getItemId()) {
  }
  return false;
}
 

Example 19

From project Android, under directory /AndroidNolesCore/src/activities/.

Source file: BaseSinglePaneActivity.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
  if (item.getItemId() == android.R.id.home) {
    finish();
  }
  return super.onOptionsItemSelected(item);
}
 

Example 20

From project android-api-demos, under directory /src/com/mobeelizer/demos/activities/.

Source file: BaseActivity.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override public boolean onOptionsItemSelected(final MenuItem item){
switch (item.getItemId()) {
case R.id.m_logout:
    if (Mobeelizer.checkSyncStatus().isRunning()) {
      Bundle err=new Bundle();
      err.putBoolean(IS_INFO,false);
      err.putInt(TEXT_RES_ID,R.string.e_cannotLogout);
      showDialog(D_CUSTOM,err);
      return true;
    }
  Mobeelizer.unregisterForRemoteNotifications();
Mobeelizer.logout();
mSharedPrefs.edit().remove(SESSION_CODE).remove(USER_TYPE).commit();
Intent i=new Intent(getApplicationContext(),LoginActivity.class);
startActivity(i);
finish();
return true;
default :
return super.onOptionsItemSelected(item);
}
}
 

Example 21

From project Android-automation, under directory /TmtsApp/src/com/taobao/tmts/framework/app/.

Source file: ListViewActivity.java

  15 
vote

@Override public boolean onContextItemSelected(MenuItem item){
switch (item.getItemId()) {
case 0:
    Toast.makeText(this,"Item One",Toast.LENGTH_SHORT).show();
  break;
case 1:
Toast.makeText(this,"Item Two",Toast.LENGTH_SHORT).show();
break;
default :
break;
}
return super.onContextItemSelected(item);
}
 

Example 22

From project android-bankdroid, under directory /src/com/liato/bankdroid/.

Source file: MainActivity.java

  15 
vote

@Override public boolean onOptionsItemSelected(final MenuItem item){
  Intent intent;
switch (item.getItemId()) {
case R.id.toggle_hidden:
    showHidden=!showHidden;
  if (showHidden) {
    item.setTitle(R.string.menu_hide_hidden);
  }
 else {
    item.setTitle(R.string.menu_show_hidden);
  }
refreshView();
return true;
case R.id.settings:
intent=new Intent(this,SettingsActivity.class);
this.startActivity(intent);
return true;
case R.id.about:
intent=new Intent(this,AboutActivity.class);
startActivity(intent);
return true;
case R.id.donate:
intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KWRCBB4PAA3LC"));
startActivity(intent);
return true;
}
return false;
}
 

Example 23

From project android-client, under directory /xwiki-android-client/src/org/xwiki/android/client/blog/.

Source file: EditPostActivity.java

  15 
vote

@Override public boolean onContextItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.miSyncDaemon:
    toSyncDaemon(mydoc.unwrap());
  return true;
default :
return super.onContextItemSelected(item);
}
}
 

Example 24

From project android-client_2, under directory /src/org/mifos/androidclient/templates/.

Source file: MifosActivity.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.changeServerAddress:
    SharedPreferences settings=getSharedPreferences(ApplicationConstants.MIFOS_APPLICATION_PREFERENCES,MODE_PRIVATE);
  String currentAddress=settings.getString(ApplicationConstants.MIFOS_SERVER_ADDRESS_KEY,getString(R.string.server_name_template));
mUIUtils.promptForTextInput(getString(R.string.dialog_server_address),currentAddress,new UIUtils.DialogCallbacks(){
  @Override public void onCommit(  Object inputData){
    String newAddress=(String)inputData;
    newAddress=newAddress.trim();
    SharedPreferences settings=getSharedPreferences(ApplicationConstants.MIFOS_APPLICATION_PREFERENCES,MODE_PRIVATE);
    if (settings.contains(ApplicationConstants.MIFOS_SERVER_ADDRESS_KEY)) {
      String oldAddress=settings.getString(ApplicationConstants.MIFOS_SERVER_ADDRESS_KEY,"");
      if (oldAddress.equals(newAddress)) {
        return;
      }
    }
    SharedPreferences.Editor editor=settings.edit();
    editor.putString(ApplicationConstants.MIFOS_SERVER_ADDRESS_KEY,newAddress);
    editor.commit();
    mUIUtils.displayLongMessage(getString(R.string.toast_address_set));
    logOut();
  }
  @Override public void onCancel(){
  }
}
);
break;
case R.id.logOut:
logOut();
break;
case R.id.synchronize:
break;
default :
break;
}
return super.onOptionsItemSelected(item);
}
 

Example 25

From project Android-File-Manager, under directory /src/com/nexes/manager/.

Source file: Main.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case MENU_MKDIR:
    showDialog(MENU_MKDIR);
  return true;
case MENU_SEARCH:
showDialog(MENU_SEARCH);
return true;
case MENU_SPACE:
return true;
case MENU_SETTING:
Intent settings_int=new Intent(this,Settings.class);
settings_int.putExtra("HIDDEN",mSettings.getBoolean(PREFS_HIDDEN,false));
settings_int.putExtra("THUMBNAIL",mSettings.getBoolean(PREFS_THUMBNAIL,true));
settings_int.putExtra("COLOR",mSettings.getInt(PREFS_COLOR,-1));
settings_int.putExtra("SORT",mSettings.getInt(PREFS_SORT,0));
settings_int.putExtra("SPACE",mSettings.getInt(PREFS_STORAGE,View.VISIBLE));
startActivityForResult(settings_int,SETTING_REQ);
return true;
case MENU_QUIT:
finish();
return true;
}
return false;
}
 

Example 26

From project Android-File-Manager-Tablet, under directory /src/com/nexes/manager/tablet/.

Source file: MainActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  menu.add(0,MENU_SEARCH,0,"Search").setIcon(R.drawable.search).setActionView(mSearchView).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
  menu.add(0,MENU_DIR,1,"New Folder").setIcon(R.drawable.newfolder).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
  menu.add(0,MENU_MULTI,2,"Multi-Select").setIcon(R.drawable.multiselect).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
  menu.add(0,MENU_SETTINGS,5,"Settings").setIcon(R.drawable.settings_actbar).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
  return true;
}
 

Example 27

From project android-flash-cards, under directory /src/org/thomasamsler/android/flashcards/fragment/.

Source file: CardSetsFragment.java

  15 
vote

@Override public boolean onContextItemSelected(MenuItem item){
  AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
  int listItemPosition=(int)getListAdapter().getItemId(info.position);
switch (item.getGroupId()) {
case MENU_ITEM_ADD:
    addCard(listItemPosition);
  break;
case MENU_ITEM_DELETE:
deleteCardSet(listItemPosition);
break;
default :
Log.w(AppConstants.LOG_TAG,"List context menu selection not recognized.");
}
return false;
}
 

Example 28

From project Android-Flashcards, under directory /src/com/secretsockssoftware/androidflashcards/.

Source file: AndroidFlashcards.java

  15 
vote

@Override public boolean onMenuItemSelected(int featureId,MenuItem item){
switch (item.getItemId()) {
case FEED_BACK_ID:
    final Intent emailIntent=new Intent(android.content.Intent.ACTION_SEND);
  emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[]{"[email protected]"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Android Flashcards Feedback");
startActivity(Intent.createChooser(emailIntent,"Send Feedback..."));
return true;
case GET_LESSONS_ID:
final Intent glIntent=new Intent(this,DownloadableLessonList.class);
startActivityForResult(glIntent,0);
return true;
case RESCAN_ID:
parseLessons();
return true;
}
return super.onMenuItemSelected(featureId,item);
}
 

Example 29

From project Android-GifStitch, under directory /src/com/phunkosis/gifstitch/.

Source file: BrowseGifsActivity.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.mi_browse_share:
    this.showShareOptionsDialog();
  return true;
case R.id.mi_browse_delete:
this.showConfirmDeleteDialog();
return true;
default :
return super.onOptionsItemSelected(item);
}
}
 

Example 30

From project android-joedayz, under directory /Proyectos/Sudoku04/src/pe/joedayz/sudoku/.

Source file: Sudoku.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.settings:
    startActivity(new Intent(this,Prefs.class));
  return true;
}
return false;
}
 

Example 31

From project android-mapviewballoons, under directory /android-mapviewballoons-example/src/mapviewballoons/example/simple/.

Source file: SimpleMap.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
  if (item.getItemId() == 0) {
    if (itemizedOverlay.getFocus() != null) {
      itemizedOverlay.hideBalloon();
    }
    mapOverlays.remove(itemizedOverlay);
    mapView.invalidate();
  }
  return true;
}
 

Example 32

From project android-ocr, under directory /android/src/edu/sfsu/cs/orange/ocr/.

Source file: CaptureActivity.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
  Intent intent;
switch (item.getItemId()) {
case SETTINGS_ID:
{
      intent=new Intent().setClass(this,PreferencesActivity.class);
      startActivity(intent);
      break;
    }
case ABOUT_ID:
{
    intent=new Intent(this,HelpActivity.class);
    intent.putExtra(HelpActivity.REQUESTED_PAGE_KEY,HelpActivity.ABOUT_PAGE);
    startActivity(intent);
    break;
  }
}
return super.onOptionsItemSelected(item);
}
 

Example 33

From project android-pedometer, under directory /src/name/bagi/levente/pedometer/.

Source file: Pedometer.java

  15 
vote

public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case MENU_PAUSE:
    unbindStepService();
  stopStepService();
return true;
case MENU_RESUME:
startStepService();
bindStepService();
return true;
case MENU_RESET:
resetValues(true);
return true;
case MENU_QUIT:
resetValues(false);
unbindStepService();
stopStepService();
mQuitting=true;
finish();
return true;
}
return false;
}
 

Example 34

From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.

Source file: ContainerObjectDetails.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.delete_object:
    showDialog(deleteObject);
  return true;
case R.id.refresh:
loadObjectData();
return true;
}
return false;
}
 

Example 35

From project Android-RTMP, under directory /android-ffmpeg-prototype/src/com/camundo/.

Source file: AudioActivity.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_quit:
    if (capturing) {
      stopCall();
    }
  finish();
return true;
default :
return super.onOptionsItemSelected(item);
}
}
 

Example 36

From project Android-Simple-Social-Sharing, under directory /SimpleSocialSharingExample/src/com/nostra13/example/socialsharing/.

Source file: FacebookActivity.java

  15 
vote

public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.item_logout:
    facebook.logout();
  return true;
default :
return false;
}
}
 

Example 37

From project android-tether, under directory /src/og/android/tether/.

Source file: AccessControlActivity.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem menuItem){
  boolean supRetVal=super.onOptionsItemSelected(menuItem);
  Log.d(MSG_TAG,"Menuitem:getId  -  " + menuItem.getItemId());
switch (menuItem.getItemId()) {
case MENU_APPLY:
    this.saveWhiteList();
  this.clientAdapter.saveRequired=false;
this.toggleACFooter();
if (TetherService.singleton != null) TetherService.singleton.restartSecuredWifi();
break;
case MENU_RELOAD_CLIENTS:
this.clientAdapter.refreshData(AccessControlActivity.this.getCurrentClientData());
}
return supRetVal;
}
 

Example 38

From project android-voip-service, under directory /src/main/java/org/linphone/.

Source file: HistoryActivity.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_clear_history:
    LinphoneManager.getLc().clearCallLogs();
  setListAdapter(new CallHistoryAdapter(this));
break;
default :
Log.e("Unknown menu item [",item,"]");
break;
}
return false;
}
 

Example 39

From project android-vpn-settings, under directory /src/com/android/settings/vpn/.

Source file: VpnEditor.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case MENU_SAVE:
    if (validateAndSetResult())     finish();
  return true;
case MENU_CANCEL:
if (profileChanged()) {
  showDialog(CONFIRM_DIALOG_ID);
}
 else {
  finish();
}
return true;
}
return super.onOptionsItemSelected(item);
}
 

Example 40

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/activity/.

Source file: AbsListActivity.java

  15 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
  mListController.onOptionsItemSelected(item);
switch (item.getItemId()) {
case MENU_REMOTE:
    final Intent intent;
  if (getSharedPreferences("global",Context.MODE_PRIVATE).getInt(RemoteController.LAST_REMOTE_PREFNAME,-1) == RemoteController.LAST_REMOTE_GESTURE) {
    intent=new Intent(this,GestureRemoteActivity.class);
  }
 else {
    intent=new Intent(this,RemoteActivity.class);
  }
intent.addFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
return true;
case MENU_NOW_PLAYING:
startActivity(new Intent(this,NowPlayingActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}