定义一个QuickContactBadge,先要实现点击弹出关联的手机上已经有的联系人的界面。不知道哪里出错了,每次点击都是是否添加新的联系人提示。求帮助。

XML代码如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<QuickContactBadge
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/qcb"
android:background="@drawable/ic_launcher"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16dp"
android:text="看看是谁"/>
</LinearLayout>
JAVA代码如下:
public class MainActivity extends Activity {
QuickContactBadge qcb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
qcb=S(R.id.qcb);
qcb.assignContactFromPhone("10086", false);
qcb.setMode(QuickContact.MODE_SMALL);
}
@SuppressWarnings("unchecked")
public <T extends View>T S(int resId){
return (T) super.findViewById(resId);
}
}