@ SuppressWarnings ( "deprecation" ) public static void setBackground ( @ NonNull final View view , @ Nullable final Drawable background ) { Condition . INSTANCE . ensureNotNull ( view , "The view may not be null" ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) { view . setBackground ( background ) ; } else { view . setBackgroundDrawable ( background ) ; } }
Sets the background of a view . Depending on the device s API level different methods are used for setting the background .