Nick Owens wrote:
> On another note, is it possible to provide a conditional instruction for
> formatting date/time based on the user's Android package:
>
> if (package > 1.1) {
>
> //cooler date time format
>
> } else {
>
> //regular date time format
>
> }
Yes, either via reflection or via conditional class loading.
> Let me guess? It is technically possible, but not in Eclipse since Eclipse
> won't even let it compile w/ a function that doesn't compile.
No, it should work fine. However, you need to compile for the higher
version.
> Or can I
> build it for Android 1.2 but allow users of 1.1 to download it by specifying
> a different min-SDK level than it is built for?
Dunno. What's Android 1.2? :-)
> If so, can I write a
> conditional instruction based on the device's SDK level?
Yes, either via reflection or via conditional class loading.
This was discussed here:
http://stackoverflow.com/questions/2312321/how-to-use-contacts-api-for-android-1-x-and-2-x-simultaneously
and here:
http://stackoverflow.com/questions/2044985/android-contactscontract-and-building-across-multiple-sdk-versions
Some sample projects are here:
http://github.com/commonsguy/cw-advandroid/tree/master/Contacts/Pick/
http://github.com/commonsguy/cw-advandroid/tree/master/Contacts/Spinners/
First one uses reflection, second one uses conditional class loading.
Here are two more samples:
http://github.com/commonsguy/cw-android/tree/master/APIVersions/
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Warescription: Three Android Books, Plus Updates, One Low Price!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en