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:geert.stef.sm.beheerautokm.AddRitActivity.java

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

    if (id == R.id.action_logOff) {
        manager.logOff();//from  w  ww . java  2s  .  c  om
        Intent intent = new Intent(AddRitActivity.this, MainActivity.class);
        intent.putExtra("parcel", manager);
        this.startActivity(intent);
        this.finish();
        return true;
    }

    if (id == R.id.action_about) {
        Intent intent = new Intent(AddRitActivity.this, AboutActivity.class);
        intent.putExtra("parcel", manager);
        this.startActivity(intent);
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.eTilbudsavis.sdkdemo.CatalogViewer.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {

    case MENU_PAGEOVERVIEW:
        // We have created a simple DialogFragment - ready to use

        // The first element of the array returned in getPages is (almost) guaranteed to be set
        int page = mPageflip.getPages()[0];
        Catalog catalog = mPageflip.getCatalog();
        PageGridOverview f = PageGridOverview.newInstance(catalog, page);
        f.setOnItemClickListener(new OnItemClickListener() {

            @Override//from w ww .  j a  v a  2 s. c o m
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                mPageflip.setPage(position);
            }
        });
        f.show(getSupportFragmentManager(), "PageGridOverview");
        break;

    }

    return super.onOptionsItemSelected(item);
}

From source file:au.com.wallaceit.reddinator.ViewAllSubredditsActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        onBackPressed();/*  w  w  w . j  av a2 s.c  o m*/
        return true;
    }
    return false;
}

From source file:net.gromgull.android.bibsonomyposter.BibsonomyPosterActivity.java

/**
 * Called when a menu item is selected.//from  w  w w .j a  v  a 2  s.  c  o  m
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case SAVE_ID:
        save();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:markson.visuals.sitapp.CCActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.ccback:
        Log.e("n", " CC Menu Back Button Pressed");
        finish();// w  w  w  .j  a  v  a 2 s.  c  o m
        break;
    case R.id.ccrefresh:
        new x2jprogress().execute();
        break;
    case R.id.clist:
        /*Intent switchtoccset = new Intent(ClassesActivity.this, ccTabActivity.class);
        startActivity(switchtoccset);
        break;*/
        Intent switchtoccset = new Intent(CCActivity.this, settingActivity.class);
        startActivity(switchtoccset);
        break;
    }
    return true;
}

From source file:ar.uba.fi.mileem.SimpleFormActivity.java

public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_legalnotices:
        String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext());
        AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(SimpleFormActivity.this);
        LicenseDialog.setTitle("Legal Notices");
        LicenseDialog.setMessage(LicenseInfo);
        LicenseDialog.show();/*from  ww  w  . j  av a 2  s.co  m*/
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:edu.asu.msse.dssoni.moviedescrpitionapp.AddActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    android.util.Log.d(this.getClass().getSimpleName(), "called onOptionsItemSelected()");
    Intent i = new Intent(this, AddActivity.class);
    switch (item.getItemId()) {
    case R.id.action_add:
        i.putExtra("message", "This is a search dialog");
        startActivityForResult(i, 1);/*  w  ww .j a  v  a2  s .  c  o m*/
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:me.kartikarora.transfersh.activities.TransferActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.action_about) {
        startActivity(new Intent(this, AboutActivity.class));
    } else if (item.getItemId() == R.id.action_refresh) {
        updateWidgets();/*w  w  w  .  ja va 2 s  .c  om*/
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.wart.magister.SelectSchoolActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        NavUtils.navigateUpFromSameTask(this);
        return true;
    } else/*  w  w w .j  a v  a 2s  . co  m*/
        return super.onOptionsItemSelected(item);
}

From source file:mad.codeforcommunity.CalendarView.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.monthI:
        //returns to the current month 
        Time today = new Time(Time.getCurrentTimezone());
        Intent intent = new Intent(this, CalendarView.class);
        intent.putExtra("date", today.year + "-" + today.month + "-" + today.monthDay);
        startActivityForResult(intent, 1);
        break;/*from  ww  w .  j a  v a2 s. com*/
    case R.id.dayI:
        setContentView(findViewById(R.layout.calendar_item));
        //returns to the current date
        loadEventView(findViewById(R.layout.calendar_item));
        break;
    case R.id.createI:
        //go to webpage to create new event
        //setContentView(R.layout.create_layout);
        Intent createInt = new Intent(this, CreateEvent.class);
        startActivity(createInt);
        break;
    case R.id.refreshI:
        //refresh the calendar
        refreshCalendar();
        break;
    }
    return true;
}