我怎么能访问所有消息(SMS)文件夹中的手机吗? [英] How can i access to all the message ( sms ) folder in the phone ?
本文介绍了我怎么能访问所有消息(SMS)文件夹中的手机吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写根据一些常规的前pretion一些简单的应用程序,将寻找一些消息(短信)。
I writing some simple application that will look for some message ( sms message ) according to some regular expretion.
我无法访问的消息的文件夹 - 我该怎么办呢?
I can't access to the message folder - how can i do it ?
推荐答案
您可以尝试这样的事情(来获取目的地址和手机短信的身体):
You can try something like this (to get the destination address and the sms's body):
private Cursor smsQuerty() {
Uri query_content_uri = Uri.parse("content://sms/sent");
String[] projection = new String[] { "_id", "address", "body" };
Cursor tCursor = getContentResolver().query(query_content_uri,
projection, null, null, null);
startManagingCursor(tCursor);
return tCursor;
}
不是LOG光标看到的数据...例如:
Than log your cursor to see the data... for example:
private void logCursorForTesting(Cursor cursor) {
int colCount = cursor.getColumnCount();
Log.d(TAG, "Column count is: " + colCount);
if (cursor != null && cursor.moveToFirst()) {
while(cursor.moveToNext()) {
for (int i = 0; i < colCount; i ++) {
Log.d(TAG, "## >> " + cursor.getString(i));
}
Log.d(TAG, "---------------");
}
}
}
这篇关于我怎么能访问所有消息(SMS)文件夹中的手机吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文