Suppor tAnnot at i onsCheatSheet Addi ngGr adl edependency dependencies { compile 'com.android.support:support-annotations:23.3.0' }
Nul l nessannot at i ons
Resour ceannot at i ons
Thr eadannot at i ons
Val ueannot at i ons
@NonNull @Nullable
@StringRes @DrawableRes @DimenRes @ColorRes @InterpolatorRes
@UiThread @MainThread @WorkerThread @BinderThread
@IntRange @FloatRange @Size
Cal l Superannot at i ons
Per mi ssi onannot at i ons
@CallSuper
@RequiresPermission(Manifest.permission.
) @RequiresPermision(allOf = { Manifest.permission., Manifest.permission.})
Check Resul t sannot at i ons @CheckResult(suggest="#enforcePermission(String,int,int,String)")
Enumer at edannot at i ons @IntDef @StringDef EXAMPLE: //Define the list of accepted constants @IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS}) //Tell the compiler not to store annotation data in the .class file @Retention(RetentionPolicy.SOURCE) //Declare the NavigationMode annotation public @interface NavigationMode {} //Declare the constants public static final int NAVIGATION_MODE_STANDARD = 0; public static final int NAVIGATION_MODE_LIST = 1; public static final int NAVIGATION_MODE_TABS = 2; //Decorate the target methods with the annotation @NavigationMode public abstract int getNavigationMode(); //Attach the annotation public abstract void setNavigationMode(@NavigationMode int mode);
v 1. 0, 8/ 14/ 16