It won't be long before all Android 1.5 devices will disappear, until then it's a good idea to support them. The problem is the 'Build.VERSION.SDK_INT' was introduced only on Android 1.6, and before that there were only string values.
Here's a work-around this issue - it will return the correct value for Android 1.5+:
Note: the internal class is required since the Java virtual machine checks if a class is valid before loading it. In our case, a java VM running Android 1.5 will not be able to load Build.VERSION.SDK_INT and will crash.
UPDATE: Added VerifyError catch to prevent exceptions on some weird Android 1.5 devices.
Thursday, January 20, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment