android--短信查询(2)
来源:未知 责任编辑:责任编辑 发表时间:2015-09-09 15:30 点击:次
"body",
"type"
};
StringBuilder str=new StringBuilder();
try{
Cursor myCursor = managedQuery(Uri.parse("content://sms"),
projection,
null, null , "date desc");
str.append(processResults(myCursor));
}
catch (SQLiteException ex)
{
Log.d(LOG_TAG, ex.getMessage());
}
return str.toString();
}
/**
* 处理短信结果
*
*/
private StringBuilder processResults(Cursor cur) {
// TODO Auto-generated method stub
StringBuilder sb=new StringBuilder();
if (cur.moveToFirst()) {
String name;
String phoneNumber;
String sms;
int type;
int nameColumn = cur.getColumnIndex("person");
int phoneColumn = cur.getColumnIndex("address");
int smsColumn = cur.getColumnIndex("body");
int typeColum = cur.getColumnIndex("type");
do {
// Get the field values
name = cur.getString(nameColumn);
phoneNumber = cur.getString(phoneColumn);
sms = cur.getString(smsColumn);
type = cur.getInt(typeColum);
System.out.println("..................................");
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>