Android Save email address to contact person, email address missing problem

Source: Internet
Author: User

1. Insert the phone into the normal SIM card
2. Log in to the mailbox and add the email address to the SIM card;
3. Found email address not added, only added name or phone number
This is the Google default behavior, when saved, the security check, found that there are illegal fields will automatically filter out the field.
For SIM cards, the email field is not supported, so the field is filtered out.

If you do not want this behavior, you want to modify the contents of the saved content in the email field, do not display the SIM account, can be modified as follows.

There are altogether 3 files that need to be modified:

1. Com.android.contacts.editor.ContactEditorFragment

Find Intent Intent = new Intent (Mcontext, contacteditoraccountschangedactivity.class);
Add a line below it: Intent.putextra ("Data", Mintentextras);

2.com.android.contacts.activities.contacteditoraccountschangedactivity

Find Maccountlistadapter = new Accountslistadapter (this, accountlistfilter.accounts_contact_writable);
Add a line below it: Maccountlistadapter.filteraccountwithbundle (Getintent (). Getbundleextra ("Data"));

3.com.android.contacts.util.accountslistadapter
Add this method to the file:
public void Filteraccountwithbundle (bundle bundle) {
if (bundle = = null) {
Return
}
String email = bundle.getstring ("email");
if (! Textutils.isempty (email)) {
int count = GetCount ();
for (int i = count-1; I >= 0; i--) {
if (Maccounts.get (i). Type.equals ("SIM account")) {
Maccounts.remove (i);
}
}
}
}

Android Save email address to contact person, email address missing problem

Related Article

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.