android - Getting details of edited contact back using ACTION_EDIT and startActivityForResult() -


i maintaining list of contacts application. first pick contact using action_pick intent. saving these contacts in local database along contact_id. user may choose edit contact add information app needs. fire edit intent action_edit. have 2 questions here

  1. i saving contact_id database in order use in edit intent. first question id changes after edition ? because happens unable open contact editor same contact again.

  2. second question how can read details of edited contact ? getting in onactivityresult(). have tried use same code using in case of picking data structure returned in case of edit different seems.

you can data contacts using cursor like

string[] projection = new string[] {      contactscontract.phonelookup.display_name,      contactscontract.phonelookup._id}; // query time cursor cursor = _context.getcontentresolver()          .query("contactscontract.contacts.content_uri",                   projection, null, null, null);  if(cursor != null) {     while ( cursor.movetonext()) {         string name = cursor.getstring(cursor.getcolumnindex(                        contactscontract.phonelookup.display_name));         // other stuff     } } cursor.close(); 

take @ https://developer.android.com/training/contacts-provider/retrieve-details.html


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -