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.battlelancer.seriesguide.ui.HelpActivity.java

public boolean onOptionsItemSelected(MenuItem item) {
    int itemId = item.getItemId();
    if (itemId == android.R.id.home) {
        onBackPressed();/*from  w  ww.  j  a v a 2 s  . co  m*/
        return true;
    }
    if (itemId == R.id.menu_action_help_open_browser) {
        openInBrowser();
        return true;
    }
    if (itemId == R.id.menu_action_help_send_feedback) {
        sendEmail();
        fireTrackerEvent("Feedback");
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:io.coldstart.android.EditOIDActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        // This ID represents the Home or Up button. In the case of this
        // activity, the Up button is shown. Use NavUtils to allow users
        // to navigate up one level in the application structure. For
        // more details, see the Navigation pattern on Android Design:
        ////from   w w  w.j  a  va2  s.  co  m
        // http://developer.android.com/design/patterns/navigation.html#up-vs-back
        //
        NavUtils.navigateUpTo(this, new Intent(this, TrapListActivity.class));
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.motelabs.chromemote.bridge.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    //            case R.id.menu_switch:
    //                return true;
    default://from w ww  .  ja  v a  2 s  .co  m
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.moto.miletus.application.tabs.CommandsActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.refresh_commands:
        CommandsFragment fragment = (CommandsFragment) getSupportFragmentManager()
                .findFragmentById(R.id.commands_fragment);
        fragment.onResume();//from   w  w w .j a  va2 s  . co m
        return true;
    case android.R.id.home:
        //NavUtils.navigateUpFromSameTask(this);
        onBackPressed();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.ichi2.anki.StudyOptionsActivity.java

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

    case android.R.id.home:
        closeStudyOptions();/*w w  w  .ja v  a 2 s.c om*/
        return true;

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

From source file:cz.msebera.unbound.dns.fragments.MainLogFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case MENU_EMPTY:
        try {/*from www. j  av a2s.c  o  m*/
            FileWriter fw = new FileWriter(
                    new File(getActivity().getFilesDir(), getString(R.string.path_mainlog)), false);
            fw.write("");
            fw.close();
            Toast.makeText(getActivity(), R.string.configuration_saved, Toast.LENGTH_LONG).show();
        } catch (IOException e) {
            Log.e(TAG, getString(R.string.error_cannot_write_unbound_conf), e);
        }
    case MENU_CLEAR:
        mTextArea.setText("");
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.example.android.donebar.DoneButtonActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.cancel:
        // "Cancel"
        finish();//from  w w w.j  ava2  s.com
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:de.geeksfactory.opacclient.frontend.InfoFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.action_refresh) {
        wvInfo.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        load();//from   www  . j  ava2  s. c  o  m
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.pureexe.calinoius.environment.camera.fragment.MainFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.action_environmentcamera) {
        Intent intent = new Intent(getActivity(), EnvironmentCameraActivity.class);
        startActivity(intent);/*from   w w  w  .  j av a 2 s .c om*/
    }
    if (id == R.id.action_exifread) {
        Intent intent = new Intent(getActivity(), EXIFreadActivity.class);
        startActivity(intent);
    }
    if (id == R.id.action_compass) {
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.springsource.greenhouse.twitter.TweetsListActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch (item.getItemId()) {
    case R.id.tweets_menu_refresh:
        downloadTweets();//from  ww w .ja  v a2s  .c  om
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}