public void onClick(View v) {
Uri uri=Uri.parse(
"content://sms");
Cursor cursor = contentResolver.query(uri,
new String[]{
"date",
"type",
"body",
"address"},
null,
null,
null);
while(cursor.moveToNext()){
long date=cursor.getLong(cursor.getColumnIndex(
"date"));
int type=cursor.getInt(cursor.getColumnIndex(
"type"));
String body=cursor.getString(cursor.getColumnIndex(
"body"));
String address=cursor.getString(cursor.getColumnIndex(
"address"));
Log.d(TAG,
"address:"+address+
"date:"+date+
"type:"+type+
"body:"+body);
}
}
转载请注明原文地址: https://ju.6miu.com/read-1126022.html