Matt Kanninen wrote:
> Mind you, I don't want to use reflection, it frightens me a bit, and
> it's annoyed me and made my app harder to debug every time I've used
> it.  Eventually though we'll really want to use a feature not in 1.5.

FYI, reflection is an option here, but it is not the only solution. You
can also:

-- Implement an interface/abstract class representing your wrapper
around the APIs you're concerned about

-- Create two implementations, one using the long-term API, one using
whatever you're getting by with (e.g., for 1.5)

-- Create a singleton of the appropriate implementation based on the SDK
level reported by the device, and use that singleton (via the
interface/abstract class)

On a 1.5 device, it will never load the implementation of the new-API
class, and so it will never complain with a VerifyError and such.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training in Germany, 18-22 January 2010: http://bignerdranch.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to