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:devsoftprog.java.file.manager.android.fm_f_and.WebActivity.java

public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {

    case R.id.clip:
        try {/*from ww  w.j  a v a 2 s. c  om*/
            ClipboardManager clipboard = (ClipboardManager) WebActivity.this
                    .getSystemService(Context.CLIPBOARD_SERVICE);
            clipboard.setText(app.html);
        } catch (Exception e) {
            Toast.makeText(WebActivity.this, "error: " + e.getMessage(), Toast.LENGTH_LONG).show();
            e = null;
        }
        return true;

    default:

        return true;

    }

}

From source file:devsoftprog.java.file.manager.android.fm_f_and.WebActivity2.java

public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {

    case R.id.clip:
        try {// www. j  a  va  2 s  .  co m
            ClipboardManager clipboard = (ClipboardManager) WebActivity2.this
                    .getSystemService(Context.CLIPBOARD_SERVICE);
            clipboard.setText(app.html);
        } catch (Exception e) {
            Toast.makeText(WebActivity2.this, "error: " + e.getMessage(), Toast.LENGTH_LONG).show();
            e = null;
        }
        return true;

    default:

        return true;

    }

}

From source file:com.gmail.tylerfilla.axon.ui.activity.HelpFOSSActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        finish();//from   w w w. jav a2 s.  com
        break;
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.kanchi.periyava.Fragments.Dashboard.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.save:
        //saveClick();
        break;//w w  w .  j  ava2 s .co m
    default:
        break;
    }

    return false;
}

From source file:it.sasabz.android.sasabus.InfoActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_about: {
        new About(this).show();
        return true;
    }/*from   w ww.j  a  v a2  s  .  c om*/
    case R.id.menu_credits: {
        new Credits(this).show();
        return true;
    }
    }
    return false;
}

From source file:jp.co.ipublishing.esnavi.helpers.android.AppActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    final int id = item.getItemId();

    if (id == android.R.id.home) {
        final Intent intent = new Intent(this, MapActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        startActivity(intent);// w  w w.ja va  2  s . com
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.support.android.designlibdemo.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        mDrawerLayout.openDrawer(GravityCompat.START);
        return true;
    case R.id.menu_night_mode_system:
        setNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
        break;//from   w w w. j  a  va2s .  co  m
    case R.id.menu_night_mode_day:
        setNightMode(AppCompatDelegate.MODE_NIGHT_NO);
        break;
    case R.id.menu_night_mode_night:
        setNightMode(AppCompatDelegate.MODE_NIGHT_YES);
        break;
    case R.id.menu_night_mode_auto:
        setNightMode(AppCompatDelegate.MODE_NIGHT_AUTO);
        break;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.krayzk9s.imgurholo.activities.ImgurHoloActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    // Respond to the action bar's Up/Home button
    case android.R.id.home:
        finish();//  ww w.  ja v a  2  s. com
        /*
        Intent intent = NavUtils.getParentActivityIntent(this);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        NavUtils.navigateUpTo(this, intent);*/
        return true;
    case R.id.action_settings:
        Intent myIntent = new Intent(this, SettingsActivity.class);
        startActivity(myIntent);
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.oakesville.mythling.MediaListActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.view_list
            && getAppSettings().getMediaSettings().getViewType() == ViewType.split
            || item.getItemId() == R.id.view_split
                    && getAppSettings().getMediaSettings().getViewType() == ViewType.list)
        modeSwitch = true; // in case back button to MainActivity
    return super.onOptionsItemSelected(item);
}

From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_trainer.SignTrainerPassiveFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Log.d(TAG, "onOptionsItemSelected " + hashCode());
    if (R.id.action_toggle_learning_mode == item.getItemId()) {
        this.onToggleLearningModeListener.toggleLearningMode(LearningMode.ACTIVE);
    }/*from   w ww  .j  a v a  2s.  c o  m*/
    return super.onOptionsItemSelected(item);
}