Java tutorial
//package com.java2s; import android.os.Build; import android.view.MenuItem; public class Main { public static void setShowMenuAsAction(MenuItem menuItem, int actionEnum) { /* Action Bar is available since Android 3.0 (API level 11) */ if (Build.VERSION.SDK_INT >= 11) { menuItem.setShowAsAction(actionEnum); } } public static void setShowMenuAsAction(MenuItem menuItem) { setShowMenuAsAction(menuItem, MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); } }