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:
setbackgroundcolor(int color)
setbackgrounddrawable(drawable background)
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
Post a Comment