Java Code Examples for android.view.MenuItem.isCheckable()

The following are Jave code examples for showing how to use isCheckable() of the android.view.MenuItem class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: GitHub   File: Redirect302Sample.java   Source Code and License Vote up 5 votes
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.isCheckable()) {
        item.setChecked(!item.isChecked());
        if (item.getItemId() == MENU_ENABLE_REDIRECTS) {
            enableRedirects = item.isChecked();
        } else if (item.getItemId() == MENU_ENABLE_RELATIVE_REDIRECTs) {
            enableRelativeRedirects = item.isChecked();
        } else if (item.getItemId() == MENU_ENABLE_CIRCULAR_REDIRECTS) {
            enableCircularRedirects = item.isChecked();
        }
    }
    return super.onOptionsItemSelected(item);
}
 
Example 2
Project: GitHub   File: Redirect302Sample.java   Source Code and License Vote up 5 votes
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.isCheckable()) {
        item.setChecked(!item.isChecked());
        if (item.getItemId() == MENU_ENABLE_REDIRECTS) {
            enableRedirects = item.isChecked();
        } else if (item.getItemId() == MENU_ENABLE_RELATIVE_REDIRECTs) {
            enableRelativeRedirects = item.isChecked();
        } else if (item.getItemId() == MENU_ENABLE_CIRCULAR_REDIRECTS) {
            enableCircularRedirects = item.isChecked();
        }
    }
    return super.onOptionsItemSelected(item);
}
 
Example 3
Project: AndroidAsyncHTTP   File: Redirect302Sample.java   Source Code and License Vote up 5 votes
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.isCheckable()) {
        item.setChecked(!item.isChecked());
        if (item.getItemId() == MENU_ENABLE_REDIRECTS) {
            enableRedirects = item.isChecked();
        } else if (item.getItemId() == MENU_ENABLE_RELATIVE_REDIRECTs) {
            enableRelativeRedirects = item.isChecked();
        } else if (item.getItemId() == MENU_ENABLE_CIRCULAR_REDIRECTS) {
            enableCircularRedirects = item.isChecked();
        }
    }
    return super.onOptionsItemSelected(item);
}
 
Example 4
Project: TrendingNow   File: MainActivity.java   Source Code and License Vote up 5 votes
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
    int id = item.getItemId();


    switch(id)
    {
        case R.id.menuFree:
            feedUrl = "http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topfreeapplications/limit=%d/xml";
            break;

        case R.id.MenuPaid:
            feedUrl = "http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/toppaidapplications/limit=%d/xml";
            break;

        case R.id.menuSongs:
            feedUrl = "http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=%d/xml";
            break;

        case R.id.menuTop10:
        case R.id.menuTop25:
            if(!item.isCheckable())
            {
                item.setChecked(true);
                feedLimit = 35 - feedLimit;
            }
            break;

        case R.id.menuRef:
            feedCachedUrl = "NA";
            break;

        default:
            return super.onOptionsItemSelected(item);
    }

    downloadUrl(String.format(feedUrl, feedLimit));
    return true;
}
 
Example 5
Project: boohee_v5.6   File: MenuBuilder.java   Source Code and License Vote up 5 votes
void setExclusiveItemChecked(MenuItem item) {
    int group = item.getGroupId();
    int N = this.mItems.size();
    for (int i = 0; i < N; i++) {
        MenuItem curItem = (MenuItemImpl) this.mItems.get(i);
        if (curItem.getGroupId() == group && curItem.isExclusiveCheckable() && curItem.isCheckable()) {
            curItem.setCheckedInt(curItem == item);
        }
    }
}