How can i get the current android sdk version (1.5, 1.6, 2.0, etc.) programmatically
+6
A:
The String Build.VERSION.RELEASE
will give you the user-visible version string (i.e 1.5, 1.6, 2.0), while Build.VERSION.SDK_INT
will give you a value from Build.VERSION_CODES
that would be better to use if you want to compare against it programatically.
Erich Douglass
2009-12-10 18:57:10
Note that Build.VERSION.SDK_INT is only available on Android 1.6 and newer. Build.VERSION.SDK will work on all Android releases, including 1.5. However, once you elect to drop 1.5 support, switching to SDK_INT is a good idea.
CommonsWare
2009-12-10 19:10:42