Android examples for User Interface:Menu
set Menu Icon Enable
//package com.java2s; import android.util.Log; import android.view.Menu; import java.lang.reflect.Method; public class Main { public static void setIconEnable(Menu menu, boolean enable) { try {/*from www.j av a 2s . c o m*/ Class<?> clazz = Class .forName("com.android.internal.view.menu.MenuBuilder"); Method m = clazz.getDeclaredMethod("setOptionalIconsVisible", boolean.class); m.setAccessible(true); m.invoke(menu, enable); } catch (Exception e) { Log.w(null, e); } } }