android-contacts

Is this how to correctly set a photo to a contact on the address-book?

Deadly 提交于 2019-12-12 11:34:47
问题 Background Suppose I've found a contact by using some query on the address book. Found it by performing a query to get contact info from a specific account (like of WhatsApp), as I've written here. Now I have an image that I wish to use it to update the contact's photo. The problem I have created code based on things I've found here on StackOverflow, that update a contact photo. Thing is, some users claim it doesn't do anything. I'm not sure what causes it. Maybe bad way to access the contact

How can i get a groupId / GroupName of a Contact in Android?

梦想的初衷 提交于 2019-12-12 10:42:23
问题 I am having list of contacts present in an Android device. I want to fetch the associated groupIds and GroupName of all the contacts. I have been trying to use ContactsContract.Groups._ID to get the ID, but I am not able to get it. Can someone provide me other way to get the groupID of contact? 回答1: This is how I do it. You can probably mess around and find a faster solution by not doing two queries. The idea is to get the row id of the group from the Data table using GroupMembership.GROUP

Programmatically added Contact is not visible in Android [duplicate]

故事扮演 提交于 2019-12-12 05:16:21
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: How can I programmatically add a contact? With the help of a Google search I was able to add a Contact in my Android Application. While this works, I am not able to see that added Contact in the phone Contact List (Phonebook). Could you help me fix this? I don't know where to look, is it perhaps a versioning problem? I would be grateful if anyone who has encountered this problem would care to help me out. I

Unable to add contact in my device

这一生的挚爱 提交于 2019-12-12 04:44:13
问题 I tried following codes for adding new contact which is not working in my device.. but same code is working fine with Emulator.. I am using Samsung Galaxy fit GT-s5670. CODE STYLE - 1 ContentValues values = new ContentValues(); values.put(People.NAME,"test contact"); Uri uri = getContentResolver().insert(People.CONTENT_URI, values); Uri phoneUri = null; Uri emailUri = null; phoneUri = Uri.withAppendedPath(uri, People.Phones.CONTENT_DIRECTORY); values.clear(); values.put(People.Phones.TYPE,

Getting Bitmap from Contacts fails even though Bitmap Uri is not null

青春壹個敷衍的年華 提交于 2019-12-12 04:24:46
问题 I am trying to get the full size Contact image from the Bitmap,I know that this image is not always available...however I found that the uri of the Bitmap was not null but the code is throwing a FileNotFoundException.Why does this happen and what can I do to solve this issue? My code public Uri getFullSizePhotoUri(Uri contactUri) { //get full size photo Log.d(TAG, "Getting full size photo uri"); Uri photoUri=Uri.withAppendedPath(contactUri, ContactsContract.Contacts.Photo.DISPLAY_PHOTO); Log

Android How to read android Contacts and SIM Contacts?

拜拜、爱过 提交于 2019-12-12 03:39:12
问题 I am currently getting read only android contacts, below is the code I'm using: String[] projecao = new String[] { Contacts._ID, Contacts.LOOKUP_KEY, Contacts.DISPLAY_NAME }; String selecao = Contacts.HAS_PHONE_NUMBER + " = 1"; Cursor contatos = contexto.getContentResolver().query( ContactsContract.Contacts.CONTENT_URI, projecao, selecao, null, null); And to get Phone Number: Cursor phones = contexto.getContentResolver().query( Phone.CONTENT_URI, new String[] { Phone.NUMBER }, Phone.CONTACT

Contacts adding in Arraylist for ListView error

三世轮回 提交于 2019-12-12 02:37:28
问题 Hi in my project i have to fetch a contacts phone number and the name from the phone.I can get call the phone number and name but when i add it to the ArrayList<HashMap<String, String>> i'm getting the only the last value i don't know why. but when i log it i'm getting all the value can u guys help me where did i go wrong public class Contacts extends Activity { Button btnGetContacts; int z = 1; String namereview = null; public String phoneNumber1 = "", phoneNumber, name1, url,urljoingroup;

how to get android contact list data on my seperate listview in android 2.1?

感情迁移 提交于 2019-12-12 01:54:05
问题 i have created one listview.now i want to show data(contact no.,name) from contactlist of android(Phonebook) on my listview. i got it for android 1.5 but i want to do it for android2.1updated. How to do it?can any one guide me or give some sample code? Thanks in advance--- 回答1: If you have achieved it in 1.5 then there can be a small difference of URI. You should go for updated/changed URI of Contacts in 2.1. For further understanding here is a sample code for 2.1updated: ContentResolver cr =

issue about getting Contact in android

谁说我不能喝 提交于 2019-12-12 01:43:55
问题 i have Developed an application that have facility of saving Phone Number and getting Contact from Phone Directory but i getting error in my code my code is @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == PICK_CONTACT && resultCode == getActivity().RESULT_OK && null != data) { Uri contactData = data.getData(); Cursor c = getActivity().getContentResolver().query(contactData, null,

Only get android contacts that are saved to the phone or sim

风格不统一 提交于 2019-12-12 01:39:53
问题 I am trying to retrieve contacts on an android device that are explicitly saved (i.e. not the ones returned by gmail or Facebook and other apps that save contact-like information). I have been playing around with this code block from the PhoneGap contacts plugin: Cursor idCursor = mApp.getActivity().getContentResolver().query(ContactsContract.Data.CONTENT_URI, new String[] { ContactsContract.Data.CONTACT_ID }, whereOptions.getWhere(), whereOptions.getWhereArgs(), ContactsContract.Data.CONTACT