My application supports android version 2.3.3 (SDK 10) and above. I have a simple code:
private void setBackgroundToView(View view, Drawable drawable) {
if (Build.VERSION.SDK_INT >= 16) {
view.setBackground(drawable);
} else {
view.setBackgroundDrawable(drawable);
}
}
I found that on GT-I9100G with android 4.0.3 which would have sdk version 15 follow log:
I/dalvikvm(13683): Could not find method android.view.View.setBackground, referenced from method %some_package%.setBackgroundToView
It means that Build.VERSION.SDK_INT
has value more than 15.
How can I prevent illegal calling of unsupported method in this case?
Have every devices and os versions with firmwares same sdk_int for same SDK versions?
Can I use Build.VERSION.RELEASE to additional check number of version?