gpt4 book ai didi

android - 使用网站信息启动添加联系人 Activity

转载 作者:行者123 更新时间:2023-11-29 18:12:15 25 4
gpt4 key购买 nike

我正在尝试使用一些数据启动 native 添加联系人 Activity 。我想通了大部分。现在我只是试图通过 Intent 发送网站。这是代码

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

android.provider.ContactsContract.Intents.Insert 没有网站字段。还有其他方式传递数据吗?

最佳答案

使用它来添加网站 url :

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

关于android - 使用网站信息启动添加联系人 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10061162/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com