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:org.quantumbadger.redreader.activities.AlbumListingActivity.java

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

From source file:com.cw.litenote.media.image.GalleryGridAct.java

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

From source file:pl.bcichecki.rms.client.android.activities.EditDeviceActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.activity_edit_device_menu_save) {
        performActionSave(item);//from  www.  ja  v  a  2 s  .c o  m
        return true;
    }

    if (item.getItemId() == android.R.id.home) {
        NavUtils.navigateUpFromSameTask(this);
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.zirconi.huaxiaclient.ScoreActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_about:
        new AlertDialog.Builder(this).setTitle("About")
                .setMessage("VERSION:0.01 BETA\nJust for fun!\nAuthor:Zirconi\nMail:Geekkou@gmail.com")
                .setPositiveButton("OK", null).show();

        break;//  ww  w.  ja  va  2s  . c om
    }

    return true;
}

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

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    switch (item.getItemId()) {
    case R.id.new_game:
        new NewLocalGameDialog(act, handle).show();
        break;// ww w.  j  a v  a2  s.  c om
    case R.id.import_game:
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        intent = intent.addCategory(Intent.CATEGORY_OPENABLE).setType("text/*");
        intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
        try {
            startActivityForResult(intent, Enums.IMPORT_GAME);
        } catch (final ActivityNotFoundException e) {
            Toast.makeText(act, "No File Manager Installed", Toast.LENGTH_LONG).show();
        }
        break;
    default:
        return super.onOptionsItemSelected(item);
    }
    return true;
}

From source file:com.example.android.popularmovies.app.MoviesFragment.java

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

From source file:com.zbrown.droidsteal.activities.HijackActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case 0:/*from   ww w.j a v a 2  s. c  o  m*/
        if (webview.canGoBack())
            webview.goBack();
        break;
    case 1:
        if (webview.canGoForward())
            webview.goForward();
        break;
    case 2:
        webview.reload();
        break;
    case 3:
        selectURL();
        break;
    case 4:
        this.finish();
        break;
    }
    return false;
}

From source file:com.example.nestedarchetypeactivityexample.InnerArchetypeViewerActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
    case R.id.menu_italy:
        updateOntologies("it"); // es-ar
        return true;
    case R.id.menu_english:
        updateOntologies("en");
        return true;
    case R.id.action_quit:
        finish();/*  w w  w . j  a va  2  s .co m*/
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.hedgehog.smdb.ActionBarControlScrollViewActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.search:
        startActivity(new Intent(this, SearchActivity.class));
        break;//from w  w w  . ja v  a2 s .  co  m
    case R.id.settings:
        startActivity(new Intent(this, SettingsActivity.class));
        break;

    }
    return true;
}

From source file:de.jadehs.jadehsnavigator.fragment.NewsFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // infosys = news
    switch (item.getItemId()) {
    case R.id.refresh_infosys:
        updateRSSFeeds();/*from   w w  w. j a v a  2s. c om*/

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