@ SuppressWarnings ( "deprecation" ) @ SuppressLint ( "NewApi" ) private void setBackground ( View view , Drawable drawable ) { if ( Build . VERSION . SDK_INT >= SET_DRAWABLE_MIN_SDK ) view . setBackground ( drawable ) ; else view . setBackgroundDrawable ( drawable ) ; }
Call the appropriate method to set the background to the View