"Android" Add a contact from your address book--A detail you don't know

Source: Internet
Author: User
1 reasons:

In development, we often encounter the ability to add contacts from the Address book, but suddenly one day someone told me that my address Book add no SIM contact, and others have, this let me very puzzled, what situation, finally found the reason, recorded.

2 Solution:

This is the code that can choose the SIM card contact:

private void Openphonenum () {Intent Intent = new Intent (Intent.action_pick, CommonDataKinds.Phone.CONTENT_URI); Startactivityforresult (Intent, select_from_num);}

This is the code that does not have a SIM card contact person:

private void Openphonenum () {Intent Intent = new Intent (Intent.action_pick, ContactsContract.Contacts.CONTENT_URI); Startactivityforresult (Intent, select_from_num);}

Do you see the difference? Although they are all content_uri but different packages, so the result is not the same.

"Android" Add a contact from your address book--A detail you don't know

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.