RSS Feed
Jan 28

Android Contact Picker 2.2.0 now available on Maven Central

Posted on Monday, January 28, 2013 in Coding

The Android Contact picker library is a simple Android library which allows you in one API call to:

  1. Display list of contacts
  2. User selects a contact
  3. Display contact details
  4. User selects a phone number
  5. Perform an action with the number

Actually the library has been out for quite a while now, so you may already know/use it. However, since I first wrote the library, I have discovered the maven build tool (which is very awesome, if you configure it right).

Well Android Contact Picker is now available from the Maven Central repository and you can use it simply in your project by including the dependency in your pom file


Last I checked, if you use Eclipse, then you will need to download the project and import it into your workspace in order for Eclipse to be able to resolve the references.

However, if you use IntelliJ (which I now use for the library) then when you include the dependency in your pom file, it will download the project, import it, build and resolve all references related to the project. You can then be on your merry way building that awesome app of yours. Yeah I know, IntelliJ is cool in that regard.

This version is principally the same as the 2.1 version. So if that works for you, you can stick with it. Well, there is one small difference, custom phone number labels are now properly displayed instead of just the text “Custom”.

Dec 5

An Android Contact Picker

Posted on Monday, December 5, 2011 in Coding

Often in Android development, there is need to support the following workflow:

  1. Display list of contacts
  2. User selects a contact
  3. Display contact details
  4. User selects a phone number
  5. Perform an action with the number

There is a standard way to call the contact list in Android, but that method pulls up a new full-screen activity for showing the contact list. When the user selects a contact, it returns the contact ID to your activity and you can do what you wish with it. However, this method does not always feel well-integrated in your app and can reduce the quality of the user experience. This is especially true  for tabbed Android applications where the contact picker needs to remain embedded within the tab.

I was surprised that an API for enabling this kind of workflow was not available on Android. Searching on StackOverflow and other forums clearly show the need. So while developing CallingProxy, I had to roll a contact picker which allows the workflow enumerated in the steps above. I extracted it from the app and am making available in the hope that someone might find use for it.

The Contact Picker uses the new Fragments API in Android and supports Android API level 7 (Froyo) and above. The code for the contact picker is available on GitHub under an MIT licence. So feel free to get hacking and use it for your projects. One known issue is that the Contact Picker does not work well in landscape mode. There is a problem with switching the fragments for the different views in landscape mode. Send me a pull request on GitHub to fix it. 😉

For now, the Contact Picker only supports picking phone numbers, but can easily be extended to support email and other types of contact info. Hopefully I’ll get around to that sometime.

For now, for those who need only phone numbers, Happy hacking!