Android 启动联系人应用程序
我想从我的应用程序活动启动联系人应用程序。我不明白该怎么做。
Button contact = (Button) findViewById(R.id.contact);
contact.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Intent i4 = new Intent();
i4.setAction(Intent.ACTION_VIEW);
i4.addCategory(Intent.CATEGORY_DEFAULT);
i4.setType("vnd.android.cursor.dir/phone");
startActivity(i4);
}
});
错误:
I wanna launch the Contacts application from my application Activity. I am not able to understand how to do it.
Button contact = (Button) findViewById(R.id.contact);
contact.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Intent i4 = new Intent();
i4.setAction(Intent.ACTION_VIEW);
i4.addCategory(Intent.CATEGORY_DEFAULT);
i4.setType("vnd.android.cursor.dir/phone");
startActivity(i4);
}
});
Error:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这应该适用于从甜甜圈到姜饼的所有东西:不确定蜂窝。
This should work in everything from Donut through to Gingerbread: not sure about Honeycomb.
您可以启动联系人选择器:
或者您也可以启动应用程序:
http: //developer.android.com/reference/android/provider/Contacts.Intents.html
You can launch a contact Picker:
Or you can also launch the app:
http://developer.android.com/reference/android/provider/Contacts.Intents.html