public void getSmsInPhone() {
final String SMS_URI_ALL = "content://sms/"; // 所有短信
Uri uri = Uri.parse(SMS_URI_ALL);
String[] projection = new String[]{"_id", "address", "person",
"body", "date", "type",};
Cursor cur = getContentResolver().query(uri, projection, null,
null, "date desc"); // 获取手机内部短信
// 获取短信中最新的未读短信
// Cursor cur = getContentResolver().query(uri, projection,
// "read = ?", new String[]{"0"}, "date desc");

while (cur.moveToNext()) {
int index_Address = cur.getColumnIndex("address");
int index_Person = cur.getColumnIndex("person");
int index_Body = cur.getColumnIndex("body");
int index_Date = cur.getColumnIndex("date");
int index_Type = cur.getColumnIndex("type");
String strAddress = cur.getString(index_Address);
int intPerson = cur.getInt(index_Person);
String strbody = cur.getString(index_Body);
long longDate = cur.getLong(index_Date);
int intType = cur.getInt(index_Type);

String strType = "";
if (intType == 1) {
strType = "接收";
} else if (intType == 2) {
strType = "发送";
} else if (intType == 3) {
strType = "草稿";
} else if (intType == 4) {
strType = "发件箱";
} else if (intType == 5) {
strType = "发送失败";
} else if (intType == 6) {
strType = "待发送列表";
} else if (intType == 0) {
strType = "所以短信";
} else {
strType = "null";
}
}

if (!cur.isClosed()) {
cur.close();
cur = null;
}

}