Got the following code in the activity:
LinearLayout view = (LinearLayout) this.findViewById(R.id.viewid);
Drawable drawable = getResources().getDrawable(R.drawable.drawableid);
if (Build.VERSION.SDK_INT >= 16)
view.setBackground(drawable);
else
view.setBackgroundDrawable(drawable);
Eclipse gives me an error on setBackground
: "Call requires API level 16 (current min is 8): android.widget.LinearLayout#setBackground", and a warning on setBackgroundDrawable
: "The method setBackgroundDrawable(Drawable) from the type View is deprecated". I cannot compile my project with this error.
Why ADT doesn't detect that both setBackground*
methods are valid with the version check?