开发者

Getting error in integrating Contacts APIs in Android 1.6 and 2.0

I have seen the BusinessCard example provide in Android examples.

I am using ContactAccessor abstract class to seperate out the SDK versions.

My code is running fine for 2.0 onwards, but when I am trying to build the code in Adnroid 1.6 I am getting the following errors:

  1. Build.VERSION_CODES.ECLAIR is not resolved.
  2. Getting e开发者_如何学Crrors in the whole class in which I have used Contacts APIs from 2.0 (say in class ContactAccessorSdk5.java).

How to resolve these issues?

I want to run my App on both the versions.

Please help me.

Regards,

Dhaiwat Bhavsar.


In your Eclipse environment, open Project Properties of your project, in Android section, select Android 2.0 as Project Build Target, then click Apply/OK. If you want to test on Android 1.6, just run the app on Android 1.6 emulator/device (always build with Android 2.0)


I'm sure this has been asked on the site before, but it boils down to a few points:

  • Compile against the later version of the SDK (2.0.1 or later)
  • Read the Backward Compatibility article on the Android Developers' site
  • Implement your calls to the contacts APIs by means of a wrapper class
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜