John
John

Reputation: 1909

Android deprecated method backward-compatible

My app uses a method that was deprecated 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?

Upvotes: 3

Views: 256

Answers (1)

DeRagan
DeRagan

Reputation: 22920

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;

Upvotes: 1

Related Questions