使用SyncAdapter将徽章和意图添加到QuickContactBadge [英] Add badge and intent to QuickContactBadge with SyncAdapter

查看:93
本文介绍了使用SyncAdapter将徽章和意图添加到QuickContactBadge的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个SyncAdapter,联系人同步正常。只有我想要一个漂亮的徽章添加到联系人应用程序的QuickContactBadge中。我该如何使用它?

I have a SyncAdapter and contact syncing works fine. Only i want a nice badge added to the QuickContactBadge in the contact application. How can i get this to work?

推荐答案

我找到了解决方案。
您基本上可以在清单中告诉您哪个活动可以处理合并的联系人。进行合并时,您已经选择了一种哑剧类型,请在中为您选择的活动使用这种哑剧类型:

I found the solution. You basically tell, in your manifest, which activity can handle contacts which are merged. When doing the merging you have chosen a mime type, use this mime type in an for an activity you choose:

        <intent-filter android:icon="@drawable/hyves">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.item/vnd.hyves.profile" />
        </intent-filter>

然后,在活动开始时,您可以通过以下方式获得联系:
光标cur = getContentResolver ().query(getIntent()。getData(),null,null,null,null);

Then when the activity starts you can get the contact by doing: Cursor cur = getContentResolver().query(getIntent().getData(), null, null, null, null);

这篇关于使用SyncAdapter将徽章和意图添加到QuickContactBadge的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆