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.chess.genesis.activity.LoginFrag.java

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    if (item.getItemId() == R.id.logout) {
        new LogoutConfirm(act, handle).show();
        return true;
    }//from   www.j  ava2  s .c o  m
    return super.onOptionsItemSelected(item);
}

From source file:com.morphoss.jumble.frontend.CategoryScreenActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:

        NavUtils.navigateUpFromSameTask(this);
        return true;
    }/*w w w  .  ja va 2 s .  c om*/
    return super.onOptionsItemSelected(item);
}

From source file:jp.co.ipublishing.esnavi.activities.MapActivity.java

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

    if (id == R.id.action_refresh) {
        onMenuRefresh();//w  w  w  . j a  va  2s .  c  o m
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.google.android.gcm.demo.app.DemoActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    /*/*from  w  w  w  . j  a  va  2  s.c om*/
     * Typically, an application registers automatically, so options
     * below are disabled. Uncomment them if you want to manually
     * register or unregister the device (you will also need to
     * uncomment the equivalent options on options_menu.xml).
     */

    case R.id.options_register:
        GCMRegistrar.register(this, SENDER_ID);
        return true;
    case R.id.options_unregister:
        GCMRegistrar.unregister(this);
        return true;

    case R.id.options_clear:
        mDisplay.setText(null);
        return true;
    case R.id.options_exit:
        finish();
        return true;
    case R.id.options_refresh_data:
        MyTask task = new MyTask();
        task.execute();
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.messagesight.mqtthelper.PayloadViewer.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection

    switch (item.getItemId()) {
    case R.id.clear:

        if (isJsonView) {
            tempHeaders.clear();//  w  ww.  j  av  a2  s.  c  o m
            tempListChildren.clear();
        } else {
            headers.clear();
            listChildren.clear();
        }
        payloadAdapter.notifyDataSetChanged();

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

From source file:com.lsb.inomet.Inomet.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.config:
        lanzarConfig(null);//from  ww  w  .  j a  v  a 2  s  .c o  m
        break;
    }
    return true; /** true -> consumimos el item, no se propaga*/
}

From source file:eu.thecoder4.gpl.pleftdroid.EditEventActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case RMINVITEE_ID:
        if (mEmails.size() > 0) {
            mEmails.remove(mEmails.size() - 1);
            ((EditText) findViewById(R.id.einvitees)).setText(getInvitees());
        }//  w  w  w . j  a  v  a 2s  .  com
        return true;
    case RMDATE_ID:
        if (mDates.size() > 0) {
            mDates.remove(mDates.size() - 1);
            ((EditText) findViewById(R.id.edatetimes)).setText(getDates());
        }
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:samples.piggate.com.piggateCompleteExample.Activity_SingIn.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch (item.getItemId()) {
    case android.R.id.home:
        backButton();//from   w w w. j a  v  a2  s .  com
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.example.shiwangi.dataplan.ScreenSlideActivity.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, FetchCallTypeActivity.class));
        return true;

    case R.id.action_previous:
        // Go to the previous step in the wizard. If there is no previous step,
        // setCurrentItem will do nothing.
        mPager.setCurrentItem(mPager.getCurrentItem() - 1);
        return true;

    case R.id.action_next:
        // Advance to the next step in the wizard. If there is no next step, setCurrentItem
        // will do nothing.
        mPager.setCurrentItem(mPager.getCurrentItem() + 1);
        return true;

    case R.id.change_number:
        SharedPreferences settings = getSharedPreferences("MyPrefsFile", 0); // 0 - for private mode
        SharedPreferences.Editor editor = settings.edit();
        //Set "hasLoggedIn" to true
        editor.putBoolean("hasLoggedIn", false);
        editor.commit();/*  w w  w.j  a  v  a2 s  .  c  o  m*/
        Intent intent = new Intent(ScreenSlideActivity.this, PhoneNumber.class);
        startActivity(intent);
        break;

    }

    return super.onOptionsItemSelected(item);
}

From source file:com.perm.DoomPlay.SearchVkActivity.java

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