In Android I get the version of the SDK easily (Build.VERSION.SDK
) but I need to use LabeledIntent only if the platform is newer than 1.6 (>Build.VERSION_
Follow the wrapper class pattern documented in the page you linked to above.
You have to use reflection... The idea is good, but in your code you refer to LabeledIntent which is not available in 1.6. So when your app runs against 1.6 devices, it cannot find the class and crashes.
So the idea is to write code where you don't refer to LabeledIntent when running in 1.6. To do this, you can write a wrapper class (LabeledIntentWrapper) which extends LabeledIntent and call it in your function. So, in 1.6, the device will see a reference to a known class: LabeledIntentWrapper.