/**
* Read messages of respective phone number from msg
*
* @param activity
* @param ph_number
* @return
*/
public static void getMessageDetails(Activity activity, String ph_number) {
String forDelete_thread_id = "";
String forDelete_id = "";
String address = ph_number;
Uri allMsg = Uri.parse("content://sms/");
Cursor managedCursor = activity.getContentResolver().query(
allMsg,
new String[] { "_id", "thread_id", "address", "date", "body",
"type" }, "address=?", new String[] { address }, null);
while (managedCursor.moveToNext()) {
String msg_id = managedCursor.getString(0);
String thread_id = managedCursor.getString(1);
String address_b = managedCursor.getString(2);
String date = managedCursor.getString(3);
String msg_body = managedCursor.getString(4);
String type = managedCursor.getString(5);
}
}