2

I'm trying to use the QuickContactBadge. I would like to get an effect like this:

But when I write this code:

QuickContactBadge badge = (QuickContactBadge) findViewById(R.id.badge_small);  
badge.assignContactFromPhone("831-555-1212", true);  

I don't see the badge but I am redirected to the Contact page.

Here is layout.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <QuickContactBadge
        android:id="@+id/badge_small"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/icon" />
</LinearLayout>  

How can I see the badge?

4

2 回答 2

2

您需要将 READ_CONTACTS 权限添加到您的 AndroidManifest.xml 文件中:

<uses-permission android:name="android.permission.READ_CONTACTS" />
于 2011-09-29T03:00:34.593 回答
0

1) 注意:您必须使用 API Level 5 或以上才能使用此功能。

2)在联系页面上带您:此徽章的功能是这样的没有预先填写联系人信息。

所以现在,您需要使用未定义的电话保存联系人。保存联系人后,当您下次单击该按钮时,它将显示您想要的结果。

于 2011-04-04T09:52:45.617 回答