tags:

views:

23

answers:

1

My app uses a method that was depreciated since android 2.1 with a different method and I would like to make it work from 1.5 to 2.2. Is there a way for my app to determine which android version the user has and call the correct method based on that? or is there a better way to do this?

+1  A: 

you can check the device SDK version using inbuilt classes available in Android and then put a if else condition around it.But i am not sure if its the recommended approach...

int sdkversion=  Build.VERSION.SDK_INT;
Rahul
thanks :) I looked into that a little more and found that version.sdk_int is actually not available on cupcake, lol. but, version.sdk is. its just a string instead of an int:int sdkversion= Integer.parseInt(Build.VERSION.SDK)
John