java - setBackground and getBackground method for Build.version < 16 -


i have problem getbackground() , setbackground() method. have designed application, found out didn't check version user android system (i beginner android - lesson).

my aplication working on build.version > 15, because methods mentioned above introduced in version.

i use similar method existed before version 16. ideas?

the getbackground() method has been around since api level 1, shouldn't problem. setbackground(drawable background) introduced starting api level 16 , may cause problems on older platforms.

your alternatives are:

  1. setbackgroundcolor(int color)
  2. setbackgrounddrawable(drawable background)
  3. setbackgroundresource(int resid)

of these methods, second 1 has been deprecated since api level 16, replaced setbackground(drawable background) you're using. however, if @ actual implementation method, you'll see following:

public void setbackground(drawable background) {     //noinspection deprecation     setbackgrounddrawable(background); } 

so @ point delegate call deprecated setbackgrounddrawable() method. hence, if want quick fix, change code use 1 , you're go.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -