Example usage for android.view MenuItem getItemId

List of usage examples for android.view MenuItem getItemId

Introduction

In this page you can find the example usage for android.view MenuItem getItemId.

Prototype

public int getItemId();

Source Link

Document

Return the identifier for this menu item.

Usage

From source file:com.rubika.aotalk.Market.java

public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.update:
        handler.post(update);/*  w ww  .  j a  v  a2s .  c  om*/
        return true;
    case R.id.settings:
        showSettings();
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:net.noviden.android.shoutout.NewPostScreen.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    switch (item.getItemId()) {
    case R.id.action_send_post:
        sendPost(mNewPost.getText().toString());
        finish();//from w  w  w.ja va2  s  .co  m
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.irccloud.android.activity.PastebinEditorActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        finish();/*from   ww w .  jav a2  s  . com*/
        break;
    case R.id.action_save:
        pastecontents = paste.getText().toString();
        pastereqid = NetworkConnection.getInstance().edit_paste(pasteID, filename.getText().toString(),
                extension(), pastecontents);
        break;
    case R.id.action_send:
        pastecontents = paste.getText().toString();
        if (current_tab == 0) {
            pastereqid = NetworkConnection.getInstance().paste(filename.getText().toString(), extension(),
                    pastecontents);
        } else {
            result(RESULT_OK);
            finish();
        }
        break;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.bti360.hackathon.listview.HackathonActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // show the add dialog when the add menu item is selected
    switch (item.getItemId()) {
    case R.id.add:
        showDialog(ADD_DIALOG);// ww  w  . j  ava2 s  .co m
        break;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.redhorse.quickstart.AppAll.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    switch (item.getItemId()) {
    case ITEM_ID_SETTING:
        break;//from   w w w .  ja va  2 s  .  c o m
    case ITEM_ID_ABOUT:
        Intent setting = new Intent();
        setting.setClass(AppAll.this, Feedback.class);
        startActivity(setting);
        break;
    }
    return super.onOptionsItemSelected(item);
}

From source file:info.xuluan.podcast.SearchActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    /*      case R.id.backup_channels:
             startActivity(new Intent(this, BackupChannelsActivity.class));
             return true;/*from  w ww .  ja v a  2  s.co  m*/
          case R.id.add_channel:
             startActivity(new Intent(this, AddChannelActivity.class));
             return true;
          case R.id.list_channels:
             startActivity(new Intent(this, ChannelsActivity.class));
             return true;*/
    }
    return super.onOptionsItemSelected(item);
}

From source file:net.networksaremadeofstring.rhybudd.WriteNFCActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home: {
        finish();//from  w  w w.ja  va  2s .c  om
        return true;
    }

    default:
        return false;
    }
}

From source file:org.planetmono.dcuploader.ActivityGalleryChooser.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_gallery_chooser_update:
        new AlertDialog.Builder(ActivityGalleryChooser.this).setTitle("?")
                .setMessage(//from w  w  w .  java2  s . c o m
                        "?  ? ?  ?? ?.")
                .setIcon(android.R.drawable.ic_dialog_alert)
                .setPositiveButton("", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        refresh();
                    }
                }).setNegativeButton("", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                }).show();
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.kircherelectronics.accelerationexplorer.activity.NoiseActivity.java

/**
 * Event Handling for Individual menu item selected Identify single menu
 * item by it's id//w w  w  .  j ava  2 s  . com
 * */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {

    // Log the data
    case R.id.action_settings:

        Intent intent = new Intent(NoiseActivity.this, NoiseConfigActivity.class);
        startActivity(intent);

        return true;

    // Log the data
    case R.id.menu_settings_help:

        showHelpDialog();

        return true;

    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.free.underground.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (mDrawerToggle.onOptionsItemSelected(item)) {
        return true;
    }/*from  w  w  w  . j a v a 2s.  c  o  m*/
    // Handle action buttons
    switch (item.getItemId()) {
    case R.id.action_websearch:
        Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
        intent.putExtra(SearchManager.QUERY, getActionBar().getTitle());
        if (intent.resolveActivity(getPackageManager()) != null) {
            startActivity(intent);
        } else {
            Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show();
        }
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}