2

I am creating a widget that you can assign a contact to onClick. I used the method that is described here. This works great on standard Android phones such as the Motorola Droid, HTC Nexus One and HTC G1. The problem is for users who are using devices such as the HTC Incredible or HTC Droid Eris (Both running Sense UI) and I imagine on other phones who's OS deviates from the vanilla flavor of Android.

Using my current method I thought that the device's OS would hook into whatever that manufacture chose to use for their Contact system however users are being sent to a random list of numbers, not their Contact list. Does anyone have a suggestion on how to get those Contacts or is this just another example of the Android fragmentation issue? Any help or insight is greatly appreciated.

Community
  • 1
  • 1
sgarman
  • 6,152
  • 5
  • 40
  • 44

1 Answers1

0

Does anyone have a suggestion on how to get those Contacts or is this just another example of the Android fragmentation issue?

ACTION_PICK works just fine on all Android devices. However, bear in mind that the contacts API changed with Android 2.x, and the StackOverflow entry you linked to was from 13 months ago, back before Android 1.5 even existed (if I remember the timeline properly).

Your best approach will be to create a common Java interface that handles your contact-related logic, with two implementations (one for the old API, one for the new). You can load up a static instance of the proper implementation for any given device and use it. You can see an example of that technique here.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks for the example. Right now my older style solution is working on on my 2.x device, so I have time to implement your bridging solution. While this solution does launch the contact manager on all Android devices it seems the other devices are not using that contact manager to manage their contacts. So when users get sent to that contact manager it has meaningless values in it and not their contacts. – sgarman May 26 '10 at 00:42
  • "Right now my older style solution is working on on my 2.x device, so I have time to implement your bridging solution." It won't work for sync'd contacts (e.g., Exchange). – CommonsWare May 26 '10 at 00:53
  • Samsung Galaxy S cannot use even that of the new api , since somehow they made a different package for rendering the native android contacts. – Mikey Sep 30 '10 at 06:36