Android的 - 用同一个电话号码的联系人列表显示 [英] Android - Show list of contacts with same phone number

查看:114
本文介绍了Android的 - 用同一个电话号码的联系人列表显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小部件,将由一个电话号码,打开联系人列表。我使用* Contacts.Intents.SHOW_OR_CREATE_CONTACT *
我知道这是pcated德$ P $,但我想这在Android 1.6的工作。我必须对查找意图使用的电话号码。这里是code

I have a widget that will open the contacts list by a phone number. I am using *Contacts.Intents.SHOW_OR_CREATE_CONTACT* I know it's deprecated but I want this to work on android 1.6. I have a phone number to use on the lookup intent. here is the code

Intent contViewIntent = new Intent(Contacts.Intents.SHOW_OR_CREATE_CONTACT);
contViewIntent.setData(Uri.fromParts("tel", number, null));

PendingIntent contPendIntent = PendingIntent.getActivity(context, 0, contViewIntent, 0);
views.setOnClickPendingIntent(viewID, contPendIntent);

当在联系人列表具有2个或更多的具有相同数目的接触,那么这将打开联系人列表,并具有用户选择一个。此工程罚款1.6,但2.0以上就说明中带刚的名字的1号或2号,当你选择这些从列表中的一个来查看你得到一个错误。

When the Contact list has 2 or more contacts with the same number then this will open the list of contacts and has the user select one. This works fine on 1.6, but on 2.0 and above it shows a list of contacts with just the number 1 or number 2 in the names and when you select one of those from the list to view you get an error.

04-09 19:12:47.891:
  ERROR / CursorWindow(105):坏请求
  现场插槽0,6。其行= 2,
  为numColumns = 6

04-09 19:12:47.891: ERROR/CursorWindow(105): Bad request for field slot 0,6. numRows = 2, numColumns = 6

04-09 19:12:47.992:
  错误/ AndroidRuntime(105):
  java.lang.IllegalStateException:获得
  从排山坳0 6场失败插槽

04-09 19:12:47.992: ERROR/AndroidRuntime(105): java.lang.IllegalStateException: get field slot from row 0 col 6 failed

我怎么得到这个在1.6及以上2.0工作?

how do I get this to work on 1.6 and 2.0 above?

推荐答案

Android 2.0的有一个的完全的新的管理联系人API(查找ContactsContract)。在我的应用程序,我结束了写低水平接触管理的两倍 - 2.0一次,一次为1.6及以下(我通过反射检查,看看是否ContactsContract类存在,并切换到2.0+ code在这种情况下)。

Android 2.0 has a completely new API for managing contacts (look up ContactsContract). In my app, I ended up writing the low-level contact management twice - once for 2.0, once for 1.6 and under (I check via reflection to see if the ContactsContract class exists and switch to the 2.0+ code in that case).

这篇关于Android的 - 用同一个电话号码的联系人列表显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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