0

Can anyone Explain how to load SMS conversation in listview after using following snippet.

ContentResolver contentResolver = getContentResolver();
final String[] projection = new String[]{"*"};
Uri uri = Uri.parse("content://mms-sms/conversations/");
Cursor query = contentResolver.query(uri, projection, null, null, null);
zapping
  • 4,118
  • 6
  • 38
  • 56
MAT
  • 1

1 Answers1

0
// Create Inbox box URI
Uri inboxURI = Uri.parse("content://sms/inbox");

// List required columns
String[] reqCols = new String[] { "_id", "address", "body" };

// Get Content Resolver object, which will deal with Content Provider
ContentResolver cr = getContentResolver();

// Fetch Inbox SMS Message from Built-in Content Provider
Cursor c = cr.query(inboxURI, reqCols, null, null, null);

Also set permission in manifest

<uses-permission android:name="android.permission.READ_SMS"></uses-permission>
Zeeshan Khan
  • 553
  • 7
  • 11