Reading Inbox SMS in Android
by Sasikumar[ Edit ] 2013-11-06 16:16:34
To Read Inbox SMS in Android we can use the following code :
TextView view = new TextView(this);
Uri uriSMSURI = Uri.parse("content://sms/inbox");
Cursor cur = getContentResolver().query(uriSMSURI, null, null, null,null);
String sms = "";
while (cur.moveToNext()) {
sms += "From :" + cur.getString(2) + " : " + cur.getString(11)+"n";
}
view.setText(sms);
setContentView(view);
We store contents in a TextView and add it to the layout view using setContentView.