android - What does the Uri returned from the contact picker actually point to? -


i trying select phone number contacts list. working fine, storing phone number. store pointer phone number if changed new number.

i think should store uri in onactivityresult, not sure points to.

the doc says startactivityforresult() *"returns content uri of selected row. form of uri table's content uri row's lookup_id appended it."*

can point me doc, or explain uri is? better way store pointer phone number, other storing uri , going through query again?

btw, may store both , implement listener on contacts database , re-query if database has been updated.

i pick contact using contact picker such;

intent pickcontactintent = new intent(intent.action_pick,contactscontract.contacts.content_uri); pickcontactintent.settype(contactscontract.commondatakinds.phone.content_type); startactivityforresult(pickcontactintent, pick_contact_request); 

then after picking phone number using this:

public void onactivityresult(int requestcode, int resultcode, intent data) {                 if (requestcode == pick_contact_request) {         if (resultcode == android.app.activity.result_ok) {             uri contacturi = data.getdata();             cursor cursor = contentresolver.query(contacturi,null, null, null, null);             if (cursor != null && cursor.movetofirst()) {                 int columnphone = cursor.getcolumnindex(phone.number);                 string number = cursor.getstring(columnphone);             }         }        } } 


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -