android 儲存手機郵件中的郵箱地址到連絡人,郵箱地址丟失的問題

來源:互聯網
上載者:User

標籤:android   for   檔案   問題   cti   sp   on   c   new   

1.手機插入普通SIM卡
2.登入郵箱並添加郵箱地址到SIM卡中;
3.探索信箱地址沒有添加進入,只添加進了姓名或電話號碼
 這是Google Default行為,在儲存時,會進行安全檢查,發現有不合法的欄位時會自動過濾掉該欄位。
對於Sim卡,不支援Email欄位,所以會過濾掉該欄位。
 
如果不想要這樣的行為,想修改為當發現儲存的內容中有Email欄位,就不顯示出SIM帳號,可按如下方式修改。
 
一共需要修改3個檔案:
 
1.  com.android.contacts.editor.ContactEditorFragment
 
找到Intent intent = new Intent(mContext, ContactEditorAccountsChangedActivity.class);
在其下面添加一行:intent.putExtra("data", mIntentExtras);
 
2.com.android.contacts.activities.ContactEditorAccountsChangedActivity
 
找到mAccountListAdapter = new AccountsListAdapter(this, AccountListFilter.ACCOUNTS_CONTACT_WRITABLE);
在其下面添加一行:mAccountListAdapter.filterAccountWithBundle(getIntent().getBundleExtra("data"));
 
3.com.android.contacts.util.AccountsListAdapter
   在該檔案中添加這個方法:
    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 儲存手機郵件中的郵箱地址到連絡人,郵箱地址丟失的問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.