首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >检索彩信地址号码

检索彩信地址号码
EN

Stack Overflow用户
提问于 2011-04-06 13:19:08
回答 1查看 2K关注 0票数 2

在我的应用程序中,我可以通过下面的代码获取所有的彩信,但我不能获取彩信地址。你们能帮帮我吗?

代码语言:javascript
复制
    Cursor cursor = activity.getContentResolver().query(Uri.parse("content://mms"),null,null,null,date DESC);
    count = cursor.getCount();
    if (count > 0) {
        cursor.moveToFirst();
        long messageId = cursor.getLong(0);
        long threadId = cursor.getLong(1);
        long timestamp = cursor.getLong(2);
        String subject = cursor.getString(3);
    }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-04-06 13:26:55

从彩信中获取地址。做一些这样的事情

在msgnumber中传递你的messageID。

代码语言:javascript
复制
String add="";
final String[] projection =  new String[] { "address", "contact_id", "charset", "type" };
final String selection = "type=137"; // "type="+ PduHeaders.FROM,

Uri.Builder builder = Uri.parse("content://mms").buildUpon();
builder.appendPath(String.valueOf(msgnumber)).appendPath("addr");

Cursor cursor = context.getContentResolver().query(
    builder.build(),
    projection,
    selection,
    null, null);

    if (cursor.moveToFirst()) {
      add =  cursor.getString(0);
    }

希望这能有所帮助。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5561786

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档