how to read and write Android myself contact -
i working android contacts, android 4.0.3. in contact app, can create, add, edit , see myself contact in it. when tried myself contact app using contentresolver, did not work. how can read , write myself contact? in advance.
edit: here code contacts
list list = new arraylist();
uri uri = contacts.content_uri; string[] projection = new string[] { contacts._id, contacts.lookup_key, contacts.display_name, contacts.has_phone_number, contacts.photo_id, contacts.last_time_contacted, contacts.times_contacted }; string sortorder = contacts.display_name + " collate localized asc"; if (sortcolumn != null) { if (sortcolumn.equals(contacts.last_time_contacted) || sortcolumn.equals(contacts.times_contacted)) sortorder = "" + sortcolumn + " collate localized desc"; } cursor cursor = null; try { cursor = context.getcontentresolver().query(uri, projection, null, null, sortorder); while (cursor.movetonext()){ list.add(getrecord(context, cursor)); } return list; } { if (cursor!=null) cursor.close(); }
try uri below.
uri uri = uri.withappendedpath( contactscontract.profile.content_uri, contactscontract.contacts.data.content_directory);
this path of "myself".
Comments
Post a Comment