Android跳轉系統連絡人介面插入連絡人 傳真\地址\郵箱\職位\部門\郵編\照片

來源:互聯網
上載者:User

private void toExecuteSave(){        Intent intent = new Intent(Intent.ACTION_INSERT);        intent.setType("vnd.android.cursor.dir/person");        intent.setType("vnd.android.cursor.dir/contact");        intent.setType("vnd.android.cursor.dir/raw_contact");//        //添加姓名        intent.putExtra(Insert.NAME, mEmployee.getEmployeeName()+vUserName.getText()); //        intent.putExtra(Insert.NOTES,mEmployee.getUserName()); //        //添加職位//        intent.putExtra(Insert.JOB_TITLE,mEmployee.getJobName());//        //添加公司名稱//        intent.putExtra(Insert.COMPANY,mEmployee.getOrgName()); //        //添加郵箱//        intent.putExtra(Insert.EMAIL_TYPE,Email.TYPE_WORK); //        intent.putExtra(Insert.EMAIL,mEmployee.getOfficeEmail()); //        //添加手機//        intent.putExtra(Insert.PHONE_TYPE,Phone.TYPE_WORK_MOBILE);//        intent.putExtra(Insert.PHONE, mEmployee.getMobile());//        //添加辦公電話//        intent.putExtra(Insert.SECONDARY_PHONE_TYPE,Phone.TYPE_WORK);//        intent.putExtra(Insert.SECONDARY_PHONE, mEmployee.getOfficeTel());//        //添加傳真//        intent.putExtra(Insert.TERTIARY_PHONE_TYPE,Phone.TYPE_FAX_WORK);//        intent.putExtra(Insert.TERTIARY_PHONE, mEmployee.getFax());//        //添加地址//        intent.putExtra(Insert.POSTAL,mEmployee.getAddress());//        intent.putExtra(Insert.POSTAL_TYPE,StructuredPostal.TYPE_WORK);                      ArrayList<ContentValues> data = new ArrayList<ContentValues>();               ContentValues values1 = new ContentValues();        values1.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);        values1.put(StructuredName.PHONETIC_GIVEN_NAME, mEmployee.getEmployeeName());        values1.put(StructuredName.GIVEN_NAME, mEmployee.getEmployeeName());        values1.put(StructuredName.DISPLAY_NAME, mEmployee.getEmployeeName());        data.add(values1);        // 添加使用者名稱 職位 部門        ContentValues values2 = new ContentValues();        values2.put(Data.MIMETYPE, Organization.CONTENT_ITEM_TYPE);        values2.put(Organization.LABEL, mEmployee.getUserName());        values2.put(Organization.TITLE, mEmployee.getJobName());        values2.put(Organization.COMPANY, mEmployee.getOrgName());        values2.put(Organization.TYPE, Organization.TYPE_WORK);        data.add(values2);        // 添加郵箱        ContentValues values3 = new ContentValues();        values3.put(Data.MIMETYPE, Email.CONTENT_ITEM_TYPE);        values3.put(Email.DATA, mEmployee.getOfficeEmail());        values3.put(Email.TYPE, Email.TYPE_WORK);        data.add(values3);        // 添加手機        ContentValues values4 = new ContentValues();        if (mEmployee.getMobile().contains("或")) {            final String[] tNumbers = mEmployee.getMobile().split("或");            for (String tNum : tNumbers) {                values4.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);                values4.put(Phone.NUMBER, tNum);                values4.put(Phone.TYPE, Phone.TYPE_WORK_MOBILE);            }        } else {            values4.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);            values4.put(Phone.NUMBER, mEmployee.getMobile());            values4.put(Phone.TYPE, Phone.TYPE_WORK_MOBILE);        }        data.add(values4);        // 添加固定電話        ContentValues values5 = new ContentValues();        values5.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);        values5.put(Phone.NUMBER, mEmployee.getOfficeTel());        values5.put(Phone.TYPE, Phone.TYPE_WORK);        data.add(values5);        // 添加傳真        ContentValues values6 = new ContentValues();        values6.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);        values6.put(Phone.NUMBER, mEmployee.getFax());        values6.put(Phone.TYPE, Phone.TYPE_FAX_WORK);        data.add(values6);        // 添加地址 郵編        ContentValues values7 = new ContentValues();        values7.put(Data.MIMETYPE, StructuredPostal.CONTENT_ITEM_TYPE);        values7.put(StructuredPostal.FORMATTED_ADDRESS, mEmployee.getAddress());        values7.put(StructuredPostal.POSTCODE, mEmployee.getPostCode());        values7.put(StructuredPostal.TYPE, StructuredPostal.TYPE_WORK);        data.add(values7);        // 添加頭像        ContentValues values8 = new ContentValues();        values8.put(Data.MIMETYPE, Photo.CONTENT_ITEM_TYPE);        // if (mEmployee.getGender().equals("2"))// 為女,儲存女性預設頭像        // values.put(Photo.PHOTO,        // getDrawableToByte(R.drawable.oa_contact_head_f));        // else        // 男        values8.put(Photo.PHOTO, getDrawableToByte(R.drawable.oa_contact_head_m));               data.add(values8);        intent.putParcelableArrayListExtra(Insert.DATA, data);               context.startActivity(intent);    }

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.