Android API版本以编程方式 [英] Android API Version programmatically
本文介绍了Android API版本以编程方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
以编程方式获取Android API版本
Possible Duplicate:
Retrieving Android API version programmatically
我正在尝试检索我的应用程序正在运行的设备的当前API版本.有没有一种方法可以获取并将其存储在字符串上.这需要在1.5版本及更高版本上工作.示例将不胜感激.谢谢.
I am trying to retrieve the current API Version of the device my Application is Running. Is there a way i can get that and Store it on a String. This needs to Work on 1.5 Version and Up. Examples would be greatly appreciated. Thank you.
推荐答案
您可以通过调用Build.VERSION.SDK
来获取它.
You can get it by calling Build.VERSION.SDK
.
从1.6开始,应改用Build.VERSION.SDK_INT
因为不推荐使用Build.VERSION.SDK
.
From 1.6 on, you should use Build.VERSION.SDK_INT
instead
because Build.VERSION.SDK
is deprecated.
这篇关于Android API版本以编程方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文