开发者

Reading contacts from phone book in Android

开发者 https://www.devze.com 2023-01-12 13:10 出处:网络
I \'m trying to r开发者_如何学编程ead and display contacts from phone book in android. My Device is synced up with gmail and funambol which togehter have more than 600 records. Now by default my appli

I 'm trying to r开发者_如何学编程ead and display contacts from phone book in android. My Device is synced up with gmail and funambol which togehter have more than 600 records. Now by default my application reads gmail contacts. On selecting any contact from the displayed list, it throws an exception as the list is displaying a gmail contact which just has email and no phone no.

I need phone no to use in my application.

thanks


Take a look at this answer here. It provides all the detail you need to get the contacts right.

The reason for the crash might be because you are trying to read the phone number when there is none, causing a NullPointerException. Maybe check if it's null before you try and use it, and if it is null then ask the user to pick again.

If this isn't right, feel free to provide more detail like code and logcat logs.

0

精彩评论

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

关注公众号