展会信息港展会大全

读取短信列表。需要在AndroidManifest.xml中加入READ_SMS...
来源:互联网   发布日期:2016-01-14 11:33:01   浏览:2390次  

导读:Cursor cursor = getContentResolver().query(Uri.parse(content://sms/inbox), null, null, null, null); if (cursor.moveToFirst()) { // must check the result to prevent exception do { String msgData = ; for(int idx=0;idxcursor.getColumnCount();...

Cursor cursor = getContentResolver().query(Uri.parse("content://sms/inbox"), null, null, null, null);

if (cursor.moveToFirst()) { // must check the result to prevent exception

do {

String msgData = "";

for(int idx=0;idx<cursor.getColumnCount();idx++)

{

msgData += " " + cursor.getColumnName(idx) + ":" + cursor.getString(idx);

}

// use msgData

} while (cursor.moveToNext());

} else {

// empty box, no SMS

}

赞助本站

人工智能实验室

相关热词: android开发 android教程

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港