Mus*_*Mus 1 android android-contacts
我正在尝试使用一些数据启动本机添加联系人活动。我想通了大部分。现在我只是试图通过意图发送网站。这是代码
Intent intent = new Intent(Intent.ACTION_INSERT);
intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
// Just some examples of information you can send to pre-fill out data for the
// user. See android.provider.ContactsContract.Intents.Insert for the complete
// list.
intent.putExtra(ContactsContract.Intents.Insert.NAME, "Foo");
intent.putExtra(ContactsContract.Intents.Insert.PHONE, "123456");
intent.putExtra(ContactsContract.Intents.Insert.EMAIL, "foo@foo.com");
intent.putExtra(ContactsContract.Intents.Insert.POSTAL, "foo drive, foo");
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
android.provider.ContactsContract.Intents.Insert 没有网站字段。还有其他方法可以传递数据吗?
使用它来添加网站网址:
ArrayList<ContentValues> data = new ArrayList<ContentValues>();
ContentValues row1 = new ContentValues();
row1.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE);
row1.put(ContactsContract.CommonDataKinds.Website.URL, "www.urwebsite.com");
row1.put(ContactsContract.CommonDataKinds.Website.LABEL, "abc");
row1.put(ContactsContract.CommonDataKinds.Website.TYPE, Website.TYPE_HOME);
data.add(row1);
intent.putExtra(ContactsContract.Intents.Insert.DATA, data);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1362 次 |
| 最近记录: |