如何在Android中读取MMS数据?我想阅读我在mmssms.db存储MMS条目的位置;我使用的是游标,我想知道合适的URI;我使用的是“内容:/mms-SMS/会话”和列名“地址”(发送到)、“文本”或“主题”和“数据”列名的图像。我已经看到了mmssms.db和他们的部分表列。
3 回答
富国沪深
TA贡献1790条经验 获得超9个赞
public static String getMMSAddress(Context context, String id) {
String addrSelection = "type=137 AND msg_id=" + id;
String uriStr = MessageFormat.format("content://mms/{0}/addr", id);
Uri uriAddress = Uri.parse(uriStr);
String[] columns = { "address" };
Cursor cursor = context.getContentResolver().query(uriAddress, columns,
addrSelection, null, null);
String address = "";
String val;
if (cursor.moveToFirst()) {
do {
val = cursor.getString(cursor.getColumnIndex("address"));
if (val != null) {
address = val;
// Use the first one found if more than one
break;
}
} while (cursor.moveToNext());
}
if (cursor != null) {
cursor.close();
}
// return address.replaceAll("[^0-9]", "");
return address;}- 3 回答
- 0 关注
- 919 浏览
添加回答
举报
0/150
提交
取消
