I've tested this code as well and it is indeed backward. Using this solution, I need to set your "API Target Level" to 5 (Android 2.0), and set the minimum (android:minSdkVersion) to 3 (Android 1.5). This way I am able to compile code which reference API 5 methods and run on older devices. However, there is a major problem with that. I can't run or debug this code on older devices (<2.0) using the Eclipse plug-in. Anyone having the same problem?
This makes testing and debugging applications on older devices difficult. Aren't we doing all the extra work for the application to run on the older platforms?? Anyway, I think I have a solution (and I would like to get feedback from google guys as well): - Create a new "Java Project" - Add the "..platforms\android-2.0\Android.Jar" to the Libraries. - Write your 2.0 code in this project. - In your main project, reference the new project. - Now you can compile, run and Debug on all devices. * Whatever design pattern you choose for the loading of the new code - Don't forget to instantiate the classes by name (as in the examples above). Any other ideas? On Nov 20, 6:46 pm, stanlick <[email protected]> wrote: > Thanks Dmitri -- > > Is this test correct? > > int sdkVersion = Integer.parseInt > (Build.VERSION.SDK); // Cupcake style > if (sdkVersion >= Build.VERSION_CODES.ECLAIR) { > className = "...ContactAccessorSdk3_4"; > } else { > className = "...ContactAccessorSdk5"; > } > It looks backward? > > Peace, > Scott > > On Nov 3, 3:44 pm, Dmitri Plotnikov <[email protected]> wrote: > > > > > I just published some sample code illustrating this use of both legacy and > > new Contacts APIs in the same app. > > Seehttp://code.google.com/p/android-business-card > > > Cheers, > > - Dmitri > > > On Mon, Nov 2, 2009 at 9:31 AM, Mark Murphy <[email protected]> wrote: > > > jarkman wrote: > > > > int sdkVersion = Integer.parseInt(Build.VERSION.SDK); > > > > Note that if you are using API version 4 (1.6 and newer), there is > > > Build.VERSION.SDK_INT, which already converts this to an integer. > > > > If you are still using API version 3, you'll need to parse the String as > > > shown above. > > > > -- > > > Mark Murphy (a Commons Guy) > > >http://commonsware.com|http://twitter.com/commonsguy > > > > Android 1.6 Programming Books:http://commonsware.com/books > > > > -- > > > 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%2Bunsubs > > > [email protected]> > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en -- 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

