android - how to get contact email if available -


hi new android development pardon me if silly want email , other details of contacts in phone , store them in json here code

can 1 me other parameters of contacts email address , other stuff helpfull.

private void getnumber(contentresolver cr2) {     // todo auto-generated method stub     cursor cur = cr2.query(             contactscontract.commondatakinds.phone.content_uri, null, null,             null, null);     while (cur.movetonext()) {         try {             obj = new jsonobject();             obj.put("name",                     cur.getstring(cur                             .getcolumnindex(contactscontract.commondatakinds.phone.display_name)));             obj.put("number",                     cur.getstring(cur                             .getcolumnindex(contactscontract.commondatakinds.phone.number)));             arobj.put(a, obj);             a++;         } catch (jsonexception e) {             // todo auto-generated catch block             e.printstacktrace();         }     }     try {         contactsobj.put("contacts", arobj);     } catch (jsonexception e) {         // todo auto-generated catch block         e.printstacktrace();     } {         toast.maketext(contactstopdf.this, "done", 500).show();         cur.close();     } } 

you're on path keep on adding lines

you can different fields in :
http://developer.android.com/reference/android/provider/contactscontract.commondatakinds.html

 cursor cur = cr2.query(             contactscontract.commondatakinds.email.content_uri, null, null,             null, null);     while (cur.movetonext()) {         try {             obj = new jsonobject();             obj.put("email",cur.getstring(cur.getcolumnindex(contactscontract.commondatakinds.email.address)));             arobj.put(a, obj);             a++;         } catch (jsonexception e) {             // todo auto-generated catch block             e.printstacktrace();         }     } 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -