Example usage for android.support.v4.view MenuItem getItemId

List of usage examples for android.support.v4.view MenuItem getItemId

Introduction

In this page you can find the example usage for android.support.v4.view MenuItem getItemId.

Prototype

public int getItemId();

Source Link

Document

Return the identifier for this menu item.

Usage

From source file:mobisocial.bento.todo.ui.TodoListActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        if (mLaunchedFromBentoList) {
            finish();/*w ww  . ja v  a 2s  .  c o  m*/
            return true;
        } else {
            return mTodoListFragment.onOptionsItemSelected(item);
        }
    default:
        return mTodoListFragment.onOptionsItemSelected(item);
    }
}

From source file:foam.littlej.android.app.ui.phone.ViewReportNewsActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        finish();/* ww w.j  a  va2  s  .  c  o m*/
        return true;
    } else if (item.getItemId() == R.id.menu_forward) {

        goNext();
        return true;

    } else if (item.getItemId() == R.id.menu_backward) {

        goPrevious();
        return true;

    } else if (item.getItemId() == R.id.menu_share) {
        share();
    }

    return super.onOptionsItemSelected(item);
}

From source file:org.trosnoth.serveradmin.DashboardActivity.java

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

    case R.id.sendMessage:
        promptForMessage();/*from  ww w  . jav  a 2s .  c o  m*/
        return true;

    default:
        Log.i(LOGTAG, "Option selection fell through.");
        return super.onOptionsItemSelected(item);
    }
}

From source file:mobisocial.bento.todo.ui.TodoDetailFragment.java

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

        if (mTodoUuid != null && mTodoItem != null) {
            String title = mTitle.getText().toString();
            String description = mDescription.getText().toString();

            // update
            mTodoItem.title = title;/*from   w ww  . j a va 2  s . co m*/
            mTodoItem.description = description;
            mTodoItem.modDateMillis = System.currentTimeMillis();
            mTodoItem.modContactId = mManager.getLocalContactId();

            StringBuilder msg = new StringBuilder(
                    getResources().getString(R.string.feed_msg_updated, mManager.getLocalName()));
            String plainMsg = UIUtils.getPlainString(mManager.getBentoListItem().bento.name, msg.toString());

            mManager.updateTodo(mTodoItem, plainMsg);
        }

        // go back
        getActivity().finish();

        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:co.uk.alt236.restclient4android.activities.ActivityMain.java

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

    case R.id.menu_execute_rest_call:
        executeRequest();//from   w  w w .ja v a 2s. com
        return true;
    case R.id.menu_about:
        mUsefulBits.showAboutDialogue();
        return true;
    }

    return false;
}

From source file:uk.ac.hutton.ics.buntata.activity.AboutActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        onBackPressed();/*from w  ww. j  av  a  2 s. co  m*/
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.ushahidi.android.app.ui.phone.ListReportCommentActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        finish();/* w w  w  . ja va2s . c  om*/
        return true;

    } else if (item.getItemId() == R.id.menu_comment) {
        goToAddComment(reportId);
        return true;
    }
    return super.onOptionsItemSelected(item);

}

From source file:com.ushahidi.android.app.ui.phone.ListCheckinCommentActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        finish();//ww w .ja v a 2  s .  c om
        return true;

    } else if (item.getItemId() == R.id.menu_comment) {
        goToAddComment(checkinId);
        return true;
    }
    return super.onOptionsItemSelected(item);

}

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

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

    if (itemId == R.id.cmd_settings) {
        action = CommonMenuFragment.ACTION_SETTINGS;
    } else if (itemId == R.id.cmd_help) {
        action = CommonMenuFragment.ACTION_HELP;
    } else if (itemId == R.id.cmd_about) {
        action = CommonMenuFragment.ACTION_ABOUT;
    } else if (itemId == R.id.cmd_buy) {
        intent = AppUtils.newBuyIntent(ctx);
    }
    if (action != null) {
        intent = new Intent(action);
        intent.setPackage(ctx.getPackageName());
    }
    if (intent != null) {
        ctx.startActivity(intent);
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:mobisocial.bento.ebento.ui.EventListActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        finish();/*from w w w  .j  a va2  s .  c  om*/
        return true;
    case R.id.menu_add:
        if (mManager.isFromMusubi()) {
            goCreate();
        } else {
            goNewFeed();
        }
        return true;
    case R.id.menu_info:
        goInfo();
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}