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.tweetlanes.android.core.view.DirectMessageActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    if (super.onOptionsItemSelected(item)) {
        return true;
    }/*from w  w w  .  ja  va 2 s . c o m*/

    switch (item.getItemId()) {
    case android.R.id.home:

        if (mDeleting) {
            showNoBackToast();
            return false;
        }

        Intent returnIntent = new Intent();
        returnIntent.putExtra("statusDelete", mHasDoneDelete);
        setResult(RESULT_OK, returnIntent);
        finish();
        return true;

    default:
        return false;
    }
}

From source file:fr.bmartel.android.iotf.app.NotificationActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch (item.getItemId()) {
    case R.id.disconnect_button:
        IotSingleton.getInstance(this).disconnect(false);
        return true;
    case R.id.notification_button:
        NotificationFilterDialog notificationDialog = new NotificationFilterDialog();
        notificationDialog.setNotificationFilterListener(NotificationActivity.this);
        notificationDialog.show(fragmentManager, "notification_filter_dialog");
        return true;
    case R.id.edit_phone_notification:
        PhoneNotificationDialog phoneDialog = new PhoneNotificationDialog();
        phoneDialog.setPhoneNotificationList(messageBodyFilterList);
        phoneDialog.setPhoneNotificationListener(NotificationActivity.this);
        phoneDialog.show(fragmentManager, "notification_filter_dialog");
        return true;
    default:/*from  w w  w.j ava 2s. c  o m*/
        return super.onOptionsItemSelected(item);
    }
}

From source file:it.scoppelletti.mobilepower.app.AbstractActivity.java

/**
 * Gestione della selezione di una voce di menù.
 * //from   w w  w.j  a  v a  2s  .  c  o m
 * @param  item Voce di menù
 * @return      Indicatore di evento gestito.
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int action = item.getItemId();

    switch (action) {
    case ActionBarSupport.HOME:
        backToHome();
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:kr.co.generic.wifianalyzer.MainActivity.java

@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
    closeDrawer();/*www  .  java  2s . co  m*/
    NavigationMenu.find(menuItem.getItemId()).activateNavigationMenu(this, menuItem);
    return true;
}

From source file:com.example.piechartandlist.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_refreshing) {
        bar.setVisibility(View.VISIBLE);
        // Update color data info
        FetchDataTaskPie dataTask = new FetchDataTaskPie(this, this);
        dataTask.execute();//from   w  w w . j a va  2 s .c o  m
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:edu.stanford.mobisocial.dungbeetle.ui.fragments.FeedActionsFragment.java

public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case MENU_VIEW: {
        FeedViews.promptForView(getActivity(), mFeedUri);
        return true;
    }/*ww  w  .j  av a 2 s .  c  o m*/
    case MENU_SHARE: {
        promptForSharing();
        return true;
    }
    }
    return false;
}

From source file:com.drunkenhamster.facerecognitionfps.SnapFaceActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_Preferences: {
        Log.i(TAG, "GoogleAnalytics trackEvent Menu-Preference");
        tracker_.trackEvent(getString(R.string.GA_CAT_ACT), getString(R.string.GA_ACT_FDETMODE),
                getString(R.string.GA_LBL_CLICKED), 1);
        showDialog(R.id.PreferencesDlg);
        break;//from w w  w  .ja va 2 s . c  om
    }
    case R.id.menu_AppMode: {
        Log.i(TAG, "GoogleAnalytics trackEvent Menu-AppMode");
        tracker_.trackEvent(getString(R.string.GA_CAT_ACT), getString(R.string.GA_ACT_APPMODE),
                getString(R.string.GA_LBL_CLICKED), 1);
        showDialog(R.id.AppModeDlg);
        break;
    }
    }
    return true;
}

From source file:info.schnatterer.logbackandroiddemo.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        startActivity(new Intent(this, PreferencesDeveloperActivity.class));
        return true;
    }//  w  w w .j  a v  a 2 s.  c om

    return super.onOptionsItemSelected(item);
}

From source file:com.cianmcgovern.android.ShopAndShare.Share.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.exit:
        if (mLocationListener != null)
            mLocationManager.removeUpdates(mLocationListener);
        finish();/*www  .  ja  v a  2s  .co m*/
        return true;
    case R.id.help:
        new HelpDialog(this, this.getText(R.string.shareHelpMessage).toString()).show();
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:yulei.android.client.AndroidMobilePushApp.java

public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.menu_clear) {
        tView.setText("");
        return true;
    } else {// w ww  . jav a  2 s .  c o  m
        return super.onOptionsItemSelected(item);
    }
}