user1301428
user1301428

Reputation: 1783

How to show SMSs from a specific contact

From the SMS content provider I was able to extract a list of contacts with whom I have messaged (as in the native messaging app). Right now, if I select one of the contacts, all the SMS inbox and outbox is shown. How can I show only the messages from the selected contact?

Upvotes: 0

Views: 63

Answers (1)

ρяσѕρєя K
ρяσѕρєя K

Reputation: 132982

try this :

String[] smsNo={"YOUR_NUMBER"};
Cursor cursor = contentResolver.query(
                   Uri.parse("content://sms"), null,"address=?", smsNo, null);
        if (cursor.moveToFirst()) {  
                int index_Body = cursor.getColumnIndex("body");  
                do {   
                    String strbody = cursor.getString(index_Body);  
                } while (cursor.moveToNext()); 
            }

Upvotes: 1

Related Questions