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.gizwits.gizdataaccesssdkdemo.activitys.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.action_changePsw:
        if (Constant.loginType != LoginType.LoginReal) {
            Toast.makeText(MainActivity.this, "?????", Toast.LENGTH_SHORT).show();
            ;/*w w  w .  j a  v  a 2s .  co  m*/
        } else {
            Intent intent = new Intent(MainActivity.this, ChangePswActivity.class);
            startActivity(intent);
        }

        return true;
    case R.id.action_logout:
        onBackPressed();
        return true;
    case R.id.action_change2phone:
        if (Constant.loginType == LoginType.LoginReal) {
            Intent intent2 = new Intent(MainActivity.this, ChangePhoneActivity.class);
            startActivity(intent2);
        } else {
            Toast.makeText(MainActivity.this, "????", Toast.LENGTH_SHORT)
                    .show();
        }
        return true;
    case R.id.action_change2mail:
        if (Constant.loginType == LoginType.LoginReal) {
            Intent intent3 = new Intent(MainActivity.this, ChangeMailActivity.class);
            startActivity(intent3);
        } else {
            Toast.makeText(MainActivity.this, "????", Toast.LENGTH_SHORT)
                    .show();
        }
        return true;
    case R.id.action_anonychange2phone:
        if (Constant.loginType == LoginType.loginAnonymous) {
            Intent intent4 = new Intent(MainActivity.this, TransPhoneActivity.class);
            startActivity(intent4);
        } else {
            Toast.makeText(MainActivity.this, "????", Toast.LENGTH_SHORT)
                    .show();
        }
        return true;
    case R.id.action_anonychange2mail:
        if (Constant.loginType == LoginType.loginAnonymous) {
            Intent intent5 = new Intent(MainActivity.this, TransMailActivity.class);
            startActivity(intent5);
        } else {
            Toast.makeText(MainActivity.this, "????", Toast.LENGTH_SHORT)
                    .show();
        }
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.sakisds.icymonitor.fragments.graph.GraphContainerFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.item_clear: // Clear graphs
        clearGraphs();//w ww. j a  v  a 2  s.c om
        return true;
    case R.id.item_resume_pause: // Toggle graph updates
        toggleBackgroundWork();
        return true;
    case R.id.item_keep_screen_on:
        toggleKeepScreenOn();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.scigames.slidegame.Registration2RFIDActivity.java

/**
 * Called when a menu item is selected.//from w  w w  . j  a  v  a2s . c o  m
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case BACK_ID:
        finish();
        return true;
    case CLEAR_ID:
        braceletId.setText("");
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:pl.bcichecki.rms.client.android.fragments.OutboxMessagesListFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.fragment_outbox_messages_list_menu_refresh) {
        downloadData();// w ww.j  a v  a  2 s . co  m
        downloadArchivedData();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.ritul.truckshare.RegisterActivity.DriverLicenseActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
    switch (menuItem.getItemId()) {
    case android.R.id.home:
        finish();/*from  w ww .  ja v a 2s . c  om*/
    }
    return (super.onOptionsItemSelected(menuItem));
}

From source file:pl.bcichecki.rms.client.android.fragments.InboxMessagesListFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.fragment_inbox_messages_list_menu_refresh) {
        downloadData();/* w w w .  j a v  a  2  s  .  c o m*/
        downloadArchivedData();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.otaupdater.SettingsActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        NavUtils.navigateUpFromSameTask(this);
        return true;
    }//from  ww  w.ja  va2s  .  c o  m
    return false;
}

From source file:net.dian1.player.activity.HomeActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {

    case R.id.player_menu_item:
        PlayerActivity.launch(this, (Playlist) null);
        break;// w w  w.j  av  a  2  s  . com

    case R.id.about_menu_item:
        new AboutDialog(this).show();
        break;

    case R.id.settings_menu_item:
        break;

    default:

    }
    return super.onOptionsItemSelected(item);
}

From source file:org.jprofit.wsfscanner.ScannerActivity.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.
    int id = item.getItemId();
    if (id == R.id.action_scan) {
        webViewContent = null;/* w  w  w.  j  a  v a  2s  .c  o  m*/
        updateWebView();
        IntentIntegrator.initiateScan(this);
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.mobshep.insufficienttls.MainActivity.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.
    int id = item.getItemId();

    switch (id) {

    case R.id.action_settings:

        Intent goToSettings = new Intent(this, Preferences.class);
        startActivity(goToSettings);// w w w  .j  a  va 2 s  .  co m
        return true;

    case R.id.action_exit:

        this.finish();

        break;

    default:

    }
    return super.onOptionsItemSelected(item);
}