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:at.alladin.rmbt.android.sync.RMBTSyncRequestCodeFragment.java

@Override
public boolean onContextItemSelected(MenuItem mi) {
    if (mi.getItemId() == codeText.getId()) {
        ClipboardManager clipboard = (ClipboardManager) getActivity()
                .getSystemService(Context.CLIPBOARD_SERVICE);
        ClipData clip = ClipData.newPlainText("sync_code", codeText.getText());
        clipboard.setPrimaryClip(clip);// w w w . ja va  2 s . c  o m
        return true;
    }
    return super.onContextItemSelected(mi);
}

From source file:com.wooi.vibox.demo.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.demo:
        startActivity(new Intent(MainActivity.this, WBAuthActivity.class));
        break;/*from w ww  . j a  va  2s .  c  o  m*/
    case R.id.open_api:
        startActivity(new Intent(MainActivity.this, WBOpenAPIActivity.class));
        break;
    }
    return true;
}

From source file:com.example.kyle.fragmentexample.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Fragment fragment;//from www .  j av  a 2s.c  o m

    int id = item.getItemId();
    switch (id) {
    case R.id.menu_date:
        startActivity(new Intent(android.provider.Settings.ACTION_DATE_SETTINGS));
        break;
    case R.id.menu_location:
        startActivity(new Intent(android.provider.Settings.ACTION_LOCALE_SETTINGS));
        break;
    case R.id.menu_sleep:
        startActivity(new Intent(android.provider.Settings.ACTION_SOUND_SETTINGS));
    }

    return super.onOptionsItemSelected(item);
}

From source file:it.gulch.linuxday.android.widgets.BookmarksMultiChoiceModeListener.java

@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    switch (item.getItemId()) {
    case R.id.delete:
        // Remove multiple bookmarks at once
        long[] checkedItemIds = listView.getCheckedItemIds();
        List<Long> checkedItemIdsList = Arrays.asList(ArrayUtils.toObject(checkedItemIds));
        new RemoveBookmarksAsyncTask().execute(checkedItemIdsList);
        mode.finish();//from  w w  w.  jav a 2 s . co  m
        return true;
    }

    return false;
}

From source file:net.olejon.mdapp.LvhCategoriesActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home: {
        finish();//  w w w  . j a  v a  2 s . c o m
        overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right);
        return true;
    }
    default: {
        return super.onOptionsItemSelected(item);
    }
    }
}

From source file:itvector.wineguide.ui.wines.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.help:
        showDialogInfo();/*from   ww  w .  j  a  v  a2 s. c o  m*/
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.madgag.android.lazydrawables.samples.DemoListActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case CLEAR_STORAGE_ID:
        try {/* w w w.  j  av  a 2  s  .  co m*/
            deleteDirectory(storageDirectory);
        } catch (IOException e) {
            Toast.makeText(this, "Couldn't delete " + storageDirectory + " - " + e.getMessage(), LENGTH_SHORT)
                    .show();
        }
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.evvsoft.treeview.demo.DemoActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == android.R.id.home || id == 0)
        return false;
    mTheme = 0;//from www  .j  a  v  a 2  s.  c  o m
    mIndicator = 0;
    switch (id) {
    case R.style.Theme_TreeView_Light:
    case R.style.Theme_TreeView_Dark:
        mTheme = id;
        break;
    case R.drawable.expander_custom_group_holo_light:
        mIndicator = id;
        break;
    }
    recreate();
    return true;
}

From source file:com.may.ple.parking.gateway.activity.GateOutActivity.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    reasonNoScan = item.getItemId();
    Intent intent = new Intent(this, GateInActivity.class);
    intent.putExtra("isCheckOut", true);
    startActivityForResult(intent, 1);//from   w  w w .  j a  va 2  s . c o  m
    return true;
}