Searching for phone numbers with Android
I’ve been playing around with searching for contacts on the Android platform and thought I’d pass along a couple things I’ve learned.
One thing I’ve found out is that some of the classes from the books I’ve been using as reference have been deprecated. Apparently, instead of using People.NUMBER, which has been deprecated for future support of multiple accounts, I should use the ContactsContact set of interfaces to get the contacts name and number. Guess I’ll be upgrading to the Android 2.0 sdk sooner then I thought. Although according to this forum thread the previous interfaces used to specify contact column, such as People, are still supported and will access contact information from the “primary” account.
Another cool thing I figured out was how to have the phone pad soft keyboard attached to an EditText widget.
![]() |
It’s one of those, it was so easy I’m ashamed I didn’t know it, but then again, the SDK is large enough to where it’s hard to know ALL of it. Anyway, all you need to do is define the “inputType” attribute value for the EditText widget which captures the phone number.
<EditText android:id="@+id/phone_nbr" android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="phone" android:singleLine="true" />
Now, when the phone_nbr EditText box is entered, the phone pad comes up for data entry instead of the default Android soft keyboard.
There’s still many aspects of the Contacts API I haven’t investigated yet, but hopefully with the new apps I have the opportunity to work on, I’ll have lots of time to learn more about them.

