Android 如何从threads表中的recepient_ID获取联系人详细信息

Android 如何从threads表中的recepient_ID获取联系人详细信息,android,sqlite,cursor,android-contentprovider,Android,Sqlite,Cursor,Android Contentprovider,这是“threads”表实例 _id| recipient_ids| snippet 1 | 1 |Hi this is hello world 2 | 2 |Multiple send 3 | 1 3 4 |Send 与recepient_ID对应的值放在“canonical_addresses”表中 _id| address 1 |9879565655 2 |1111111111 3 |5465321348 4 |8

这是“threads”表实例

_id| recipient_ids| snippet
1  |   1          |Hi this is hello world
2  |   2          |Multiple send
3  | 1 3 4        |Send
与recepient_ID对应的值放在“canonical_addresses”表中

_id|  address
1  |9879565655
2  |1111111111
3  |5465321348
4  |8965321354
现在我必须为threads表中的每个threads.recipient\u ID获取“canonical\u addresses.address”(有时收件人\u ID可以不止一个)

注:
我正在使用
content://mms-sms/conversation
从threads表中获取详细信息。

我找不到直接的解决方案

实际上,为了获得收件人详细信息,查询
Content://sms/
带有线程id

从光标中选择不同的地址

我们将能够获得收件人的详细信息

对于更有效的方法,请回应

片段如下

Uri THREAD_ID_CONTENT_URI = Uri.parse("content://sms/");

Cursor cur = getContentResolver().query(uribuilder.build(), new String[]{"address"},"thread_id=#) group by (address", null,null);

谢谢你

你需要根据以下公式来制定查询:

String [] colAddress={"DISTINCT address"};
Cursor cur = getContentResolver().query(uriSMSURI, colAddress, null, null,null);

使用此uri进行抓取

ContentResolver cr = context.getContentResolver();
    Cursor pCur = cr.query(
            Uri.parse("content://mms-sms/canonical-addresses"), new String[]{"address"},
            "_id" + " = ?",
            new String[]{your_thread_id}, null);

    String contactAddress = null;

    if (pCur != null) {
        if (pCur.getCount() != 0) {
            pCur.moveToNext();
            contactAddress = pCur.getString(pCur.getColumnIndex("address"));
        }
        pCur.close();
    }

这种方法在只有彩信的线程上失败。并不是说我有更好的答案。。。