开发者

Android deprecated method backward-compatible

开发者 https://www.devze.com 2023-01-13 08:13 出处:网络
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 use

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开发者_Python百科 this?


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;
0

精彩评论

暂无评论...
验证码 换一张
取 消