Java tutorial
//package com.java2s; //License from project: Open Source License import android.annotation.TargetApi; import android.app.Activity; import android.os.Build; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; public class Main { @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void invalidateOptionsMenu(Activity activity) { // Not necessary in pre-Honeycomb, because menu is drawn on tap. if (isHoneycomb()) activity.invalidateOptionsMenu(); } /** * Returns true if the device has Honeycomb (3.0) or greater installed. */ public static boolean isHoneycomb() { return isApiLevel(VERSION_CODES.HONEYCOMB); // Android 3.0, API Level 11. } /** * Returns true if the device supports the specified API level (or greater). */ public static boolean isApiLevel(int apiLevel) { return (VERSION.SDK_INT >= apiLevel); } }