当前位置:操作系统 > 安卓/Android >>

Android跳转系统联系人界面插易做图系人 传真\地址\邮箱\职位\部门\邮编\照片

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);
    }

 

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,