public void refreshSmsInbox(){ ContentResolver contentResolver = getContentResolver(); 遊標smsInboxCursor = contentResolver.query(Uri.parse(「content:// sms/inbox」),null,null,null,null); int indexBody = smsInboxCursor.getColumnIndex(「body」); int indexAddress = smsInboxCursor.getColumnIndex(「address」); if(indexBody < 0 ||!smsInboxCursor.moveToFirst())return;如何在列表視圖中一起顯示發送和接收的消息
arrayAdapter.clear();
do {
String str = "SMS From: " + smsInboxCursor.getString(indexAddress) +
"\n" + smsInboxCursor.getString(indexBody) + "\n";
smsMessagesList.add(str);
} while (smsInboxCursor.moveToNext());
}