Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.view.Menu;
import android.view.MenuItem;

public class Main {
    public static void setMenuItemChecked(final Menu menu, final boolean checked, final int viewId) {
        final MenuItem v = menu.findItem(viewId);
        if (v != null) {
            v.setChecked(checked);
        }
    }

    public static void setMenuItemChecked(final Menu menu, final boolean checked, final int viewId,
            final int checkedResId, final int uncheckedResId) {
        final MenuItem v = menu.findItem(viewId);
        if (v != null) {
            v.setChecked(checked);
            v.setIcon(checked ? checkedResId : uncheckedResId);
        }
    }
}