开发者

How to start 'View Contact' Activity on android?

开发者 https://www.devze.com 2022-12-31 04:31 出处:网络
I want to create a tab which contains a tab for viewing contact detail. Here is what i did: intent = new Intent(Intent.ACTION_VIEW, Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, \"\"+co

I want to create a tab which contains a tab for viewing contact detail. Here is what i did:

    intent = new Intent(Intent.ACTION_VIEW, Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, ""+contactId));
    nativeInfo = tabHost.newTabSpec("native info").setIndicator("N Info").setContent(intent);

It throw security exception.

I appreciate your help.

开发者_开发问答

Thanks.


You need to add that permission to your manifest file, so that the user gets notified your app will read contacts when the app is installed.

<uses-permission android:name="android.permission.READ_CONTACTS" />

Take a look at this: http://developer.android.com/guide/topics/manifest/manifest-intro.html#perms

0

精彩评论

暂无评论...
验证码 换一张
取 消