任何人都可以帮助我吗?如何在android中读取新消息中的消息内容?
我想以编程方式阅读Android中新传入短信的消息正文。
我试过的东西,但不返回任何内容:
Uri uri = Uri.parse("content://sms/inbox");
ContextWrapper context = null;
Cursor c = context.getContentResolver().query(uri, null, null ,null,null);
String body = null;
String number=null;
if(c.moveToFirst()) {
body = c.getString(c.getColumnIndexOrThrow("body")).toString();
number = c.getString(c.getColumnIndexOrThrow("address")).toString();
}
c.close();
是我的代码中的任何错误 请任何人给我答案,请完全是因为我浪费了一个月的时间这个
好文章在这里:http://mobdev.olin.edu/mobdevwiki/FrontPage/Tutorials/SMS%20Messaging – 2011-10-02 18:35:19
http://stackoverflow.com/questions/14097500/get-inbox-messages-from-android-device在自定义列表视图# 它适合我。这个家伙在这里StackOverflow – texeratx 2015-12-04 13:07:30