获取详细的短信其ID的Andr​​oid短信、详细、ID、Andr

由网友(抽烟 等待死亡 #)分享简介:我想获得的手机短信详细信息(数字,文本正文,未来的时间);我只知道短信的ID。我可以查询到内容://短信这个ID,并得到详细信息? I want to get Details of SMS(Number, Text Body, Time of coming); And i only know the id of s...

我想获得的手机短信详细信息(数字,文本正文,未来的时间);我只知道短信的ID。 我可以查询到内容://短信这个ID,并得到详细信息?

I want to get Details of SMS(Number, Text Body, Time of coming); And i only know the id of sms. Can i query to "content://sms" with this id and get details?

目前,我可以做一个循环,并查询每个消息并获得详细信息。但是,当你要得到一个短信细节10倍的1000条短信,是不是有效率..... 希望大家理解这个问题。 感谢名单

At the moment i can make a loop and query for every message and get details. But that is not efficient when you have to get single sms details 10 times from 1000 sms..... Hope you understand the problem. Thanx

推荐答案

我找出我自己,但我花了一些时间,按照code对我的作品:

I figure out my self but took me some time, Following code works for me:

        Uri myMessage = Uri.parse("content://sms/");
        ContentResolver cr = getContentResolver();
        Cursor c = cr.query(myMessage, new String[] { "_id", "address", "date", "body","read" },"_id = "+smsID, null, null);

        c.moveToFirst();

        Number = c.getString(c.getColumnIndexOrThrow("address")).toString();

        ReadStatus = c.getString(c.getColumnIndex("read"));
        Body = c.getString(c.getColumnIndexOrThrow("body")).toString();

        c.close;

我失踪了条件,将光标移动到第一位。希望有人能找到它有帮助。

I was missing the condition and moving the cursor to first. Hope someone could find it helpfull.

阅读全文

相关推荐

最新文章