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;listviewで送受信されたメッセージを一緒に表示する方法
arrayAdapter.clear();
do {
String str = "SMS From: " + smsInboxCursor.getString(indexAddress) +
"\n" + smsInboxCursor.getString(indexBody) + "\n";
smsMessagesList.add(str);
} while (smsInboxCursor.moveToNext());
}