Reputation: 748
I am currently working on an android library which is to be supplied as a jar. The library will be compiled with android-18. How can I put conditional code to support different versions of android
Upvotes: 1
Views: 52
Reputation: 72563
You can do something like this:
int currentVersion = android.os.Build.VERSION.SDK_INT;
// in this case HoneyComb, but you could do this with every version
int honeycombVersion = android.os.Build.VERSION_CODE.HONEYCOMB;
if (currentVersion >= honeycombVersion ){
// do something
} else{
// do something else
}
Upvotes: 1