Android SMS show contact name by recipient_ids -


the code snippet below returns basic sms conversation data:

cursor cursor = activity.getcontentresolver().query(uri.parse( "content://mms-sms/conversations?simple=true"), null, null, null, "normalized_date desc" ); if(cursor.movetofirst())   string recipient_ids = cursor.getstring(3); 

my question how can phone's contact data given recipient_ids? in case need retrieve contact number , contact display_name.

your appreciated. in advance!

try this:

public string getcontactdata(string id){   string number;    cursor phones = fa.getcontentresolver().query(contactscontract.commondatakinds.phone.content_uri, null, contactscontract.commondatakinds.phone.contact_id +" = "+ id, null, null);      if(phones.movetofirst()) {        number = phones.getstring(phones.getcolumnindex(contactscontract.commondatakinds.phone.number));            }     phones.close();   return number; } 

hope helps!


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -