I am trying to read messages from an inbox and display them in an activity. My activity contains a button and listview. When I click on the button, all messages from the inb
add an if statement in your loop to match the selected number
String selectedNumber;
// copy the selected number to selectedNumber
do {
if(cursor.getString( indexAddr ).equals(selectedNumber))
{
String str = "Sender: " + cursor.getString( indexAddr ) + "\n" + cursor.getString( indexBody );
smsList.add( str );
}
}
while( cursor.moveToNext() );
Here only the messages from number matching the selected number will be added to smsList. It is an old question but i hope it will be helpful for someone