我有同一个联系人的 3 封电子邮件。我需要将此电子邮件更新到 Android 的电话簿。问题是当我尝试这样做时,这 3 封电子邮件的更新方式相同。3 封电子邮件的停留时间相等。存在任何区分电子邮件的方法吗?
这是我的代码
if(numEmails>1){
int auxNumEmails=1;
String tagEtEmail = "ete";
String tagBtnLabelEmail = "btnLabelMail";
//Determinar o número de email do content
do{
EditText etEmail = (EditText)contentEmail.findViewWithTag(tagEtEmail);
Button etBtnLabelEmail = (Button)contentEmail.findViewWithTag(tagBtnLabelEmail);
String stEtEmail = etEmail.getText().toString();
String stBtnLabelEmail = etBtnLabelEmail.getText().toString();
values.clear();
String mailWhere = ContactsContract.Data.CONTACT_ID + "=? AND " + ContactsContract.Data.MIMETYPE + "=?" + ContactsContract.CommonDataKinds.Email.DATA+"=?";
String[] mailWhereParams = new String[]{String.valueOf(idContacto),ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE, "2"};
values.put(ContactsContract.CommonDataKinds.Email.DATA,stEtEmail);
if(stBtnLabelEmail == "Residência"){
values.put(ContactsContract.CommonDataKinds.Email.TYPE,ContactsContract.CommonDataKinds.Email.TYPE_HOME);
values.put(ContactsContract.CommonDataKinds.Email.LABEL,stBtnLabelEmail);
}
else
if(stBtnLabelEmail == "Emprego"){
values.put(ContactsContract.CommonDataKinds.Email.TYPE,ContactsContract.CommonDataKinds.Email.TYPE_WORK);
values.put(ContactsContract.CommonDataKinds.Email.LABEL,stBtnLabelEmail);
}
**cr.update(ContactsContract.Data.CONTENT_URI, values, mailWhere, mailWhereParams);**
tagEtEmail = "ete"+auxNumEmails;
tagBtnLabelEmail = "btnLabelMail" + auxNumEmails;
auxNumEmails++;
}while(auxNumEmails<=numEmails);
我需要一种区分电子邮件的方法。ID?但是怎么做?