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:at.bitfire.davdroid.mirakel.syncadapter.EnterCredentialsFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.next:
        queryServer();//from  w  w  w.ja  v a2  s  . co  m
        break;
    default:
        return false;
    }
    return true;
}

From source file:com.example.ali.rottentomatoesmaterialsample.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        mDrawerLayout.openDrawer(GravityCompat.START);
        return true;
    }// ww  w  . j  a va2 s .co  m
    return super.onOptionsItemSelected(item);
}

From source file:geert.stef.sm.beheerautokm.HistoryActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    int id = item.getItemId();

    if (id == R.id.action_logOff) {
        Intent intent = new Intent(HistoryActivity.this, MainActivity.class);
        intent.putExtra("parcel", manager);
        this.startActivity(intent);
        this.finish();
        return true;
    }//from   www.  j av a  2s  .  c  o m
    if (id == R.id.action_about) {
        Intent intent = new Intent(HistoryActivity.this, AboutActivity.class);
        intent.putExtra("parcel", manager);
        this.startActivity(intent);
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.example.ehrtemplateviewerexample.TemplateViewerActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

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

From source file:com.google.developers.actions.debugger.CayleyActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    // Respond to the action bar's Up/Home button
    case android.R.id.home:
        NavUtils.navigateUpFromSameTask(this);
        return true;
    }//  w  w w.j  a  v a2 s.  c o  m
    return super.onOptionsItemSelected(item);
}

From source file:at.bitfire.davdroid.mirakel.syncadapter.LoginURLFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.next:
        FragmentTransaction ft = getFragmentManager().beginTransaction();

        Bundle args = new Bundle();
        String host_path = editBaseURI.getText().toString();
        args.putString(QueryServerDialogFragment.EXTRA_BASE_URI, URLUtils.sanitize(scheme + host_path));
        args.putString(QueryServerDialogFragment.EXTRA_USER_NAME, editUserName.getText().toString());
        args.putString(QueryServerDialogFragment.EXTRA_PASSWORD, editPassword.getText().toString());
        args.putBoolean(QueryServerDialogFragment.EXTRA_AUTH_PREEMPTIVE, checkboxPreemptive.isChecked());

        DialogFragment dialog = new QueryServerDialogFragment();
        dialog.setArguments(args);/*from w  ww.ja v a2  s  .c  om*/
        dialog.show(ft, QueryServerDialogFragment.class.getName());
        break;
    default:
        return false;
    }
    return true;
}

From source file:it_minds.dk.eindberetningmobil_android.views.ChooseProvider.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.provider_menu_test_api) {
        //Set the provider to Test Backend
        useProvider(new Provider("Test Backend", "http://os2indberetningmobil/api",
                "https://os2indberetning.dk/logo.png", "#FFFFFF", "#FFC107", "#4CAF50"));
    }//from   w  w  w  .  ja  va  2 s.c o m

    return super.onOptionsItemSelected(item);
}

From source file:at.bitfire.davdroid.ui.CreateAddressBookActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        Intent intent = new Intent(this, AccountActivity.class);
        intent.putExtra(AccountActivity.EXTRA_ACCOUNT, account);
        NavUtils.navigateUpTo(this, intent);
        return true;
    }// w ww. j  av  a 2  s.c o  m
    return false;
}

From source file:com.paramedic.mobshaman.activities.AccessTimeActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch (id) {
    case android.R.id.home:
        finish();//from  ww w.  jav a 2  s . co  m
        break;
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.mercandalli.android.apps.files.file.text.FileTextActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        this.finish();
        this.overridePendingTransition(R.anim.right_in, R.anim.right_out);
        return true;
    }/* ww  w  .  j a  v a 2  s  .co m*/
    return super.onOptionsItemSelected(item);
}