Often easier is to build against the newest API you want to use, so you have full access to the newer XML attributes (which will be ignored by older platforms), and use any of a number of options for avoiding use of newer APIs on older platforms. There is a general blog post on dealing with backwards compatibility here:
http://android-developers.blogspot.com/2009/04/backward-compatibility-for-android.html Also my recent post on the Service APIs makes use of a couple different strategies: http://android-developers.blogspot.com/2010/02/service-api-changes-starting-with.html On Fri, Apr 9, 2010 at 9:24 AM, Mark Murphy <[email protected]> wrote: > BrianS wrote: > > Hi I'm wondering if it's possible to have an app that has a portion of > > its code implemented using Android 1.5 (API Level 3) and part using > > 1.6. (For example maybe implementing one of the app's activities in > > 1.6 while the overall app is in 1.5)? > > You can write to the 1.5 API, then use reflection or conditional class > loading to use 1.6 classes, methods, fields, etc. The biggest area of > potential trouble will be attempting to override 1.6 methods from an > Activity or other manifest-registered component. > > Here is an example of a project using reflection: > > http://github.com/commonsguy/cw-android/tree/master/APIVersions/Tagger2/ > > Here is an example of a project using conditional class loading: > > http://github.com/commonsguy/cw-advandroid/tree/master/Contacts/Spinners/ > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > _The Busy Coder's Guide to Android Development_ Version 3.0 > Available! > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > > To unsubscribe, reply using "remove me" as the subject. > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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

