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.sawyer.advadapters.app.adapters.jsonadapter.JSONAdapterActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch (id) {
    case R.id.menu_unit_test:
        Intent intent = new Intent(this, UnitTestJSONArrayActivity.class);
        startActivity(intent);//from   www .j a  va  2 s.  co  m
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.example.android.animationsdemo.CardFlipActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        // Navigate "up" the demo structure to the launchpad activity.
        // See http://developer.android.com/design/patterns/navigation.html for more.
        NavUtils.navigateUpTo(this, new Intent(this, MainActivity.class));
        return true;

    case R.id.action_flip:
        flipCard();//from   www  . j  av  a2 s.  co  m
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.amanmehara.programming.android.activities.DetailActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch (id) {
    case R.id.action_rate: {
        rate();/* w  w  w . ja v  a  2  s.c om*/
        return true;
    }
    case android.R.id.home: {
        Map<String, Serializable> extrasMap = new HashMap<>();
        extrasMap.put("accessToken", accessToken);
        extrasMap.put("languageName", languageName);
        extrasMap.put("logoBlob", logoBlob);
        extrasMap.put("programs", programsJson);
        startActivity(ProgramActivity.class, extrasMap);
        return true;
    }
    default: {
        return super.onOptionsItemSelected(item);
    }
    }
}

From source file:com.photocitygame.android.ImageActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case MENU_CAMERA:
        doCapture();/*  w w  w.  j  a  v  a  2 s  .  c o  m*/
        return true;
    default:
        return false;
    }
}

From source file:org.openremote.android.console.Main.java

public void handleMenu(MenuItem item) {
    switch (item.getItemId()) {
    case Constants.MENU_ITEM_SETTING:
        doSettings();//  w  ww.j  av  a2 s  .c om
        break;
    case Constants.MENU_ITEM_QUIT:
        System.exit(0);
        break;
    }
}

From source file:com.fangyuan.vpngate.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_refresh:
        refresh();/*ww  w  .  j a  va  2 s .com*/
        break;

    case R.id.menu_setting:
        Intent intent = new Intent(this, SettingsActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
        break;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.paramedic.mobshaman.activities.ActualizarInformacionActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    int id = item.getItemId();
    if (id == android.R.id.home) {
        finish();/*w w w  .jav  a2  s . c  o m*/
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.antonioleiva.materializeyourapp.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        drawerLayout.openDrawer(GravityCompat.START);
        return true;
    }//  www .  jav a 2  s  .  c  o  m

    return super.onOptionsItemSelected(item);
}

From source file:com.chess.genesis.activity.MsgBoxFrag.java

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    if (item.getItemId() == R.id.resync) {
        updateMsgList();/*from w  w w .j ava 2s.c o  m*/
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.polatic.pantaudki.home.HomeFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        NavUtils.navigateUpFromSameTask(getActivity());
        return true;
    default://from   w  w w  .ja va 2  s. c o m
        return super.onOptionsItemSelected(item);
    }
}