contacts

Inserting a new contact programmatically through my app without using Intent

别来无恙 提交于 2019-12-22 10:35:03
问题 I am working with an app in with I am interacting with phone contacts. I want to add a new Contact to my phones Contacts List. I have tried the following code but it is not work: void addContact(Context ctx, PreviewContactModel model) { ArrayList<Contact_Model> contact_models = handler.getAllContacts(); Contact_Model contact_model = new Contact_Model(); ArrayList<ContentProviderOperation> contentProviderOperation = new ArrayList<>(); int rawContactID = Integer.parseInt(contact_models.get

How to use method dataWithContacts in CNContactVCardSerialization?

久未见 提交于 2019-12-22 10:30:17
问题 I am trying get NSData object with the vCard representation of the contact. My code: let contactStore = CNContactStore() let fetchRequest = CNContactFetchRequest(keysToFetch: [CNContactGivenNameKey, CNContactFamilyNameKey]) var contacts = [CNContact]() var vcard = NSData() do{ try contactStore.enumerateContactsWithFetchRequest(fetchRequest) { (contact, status) -> Void in self.fetchRequest.unifyResults = true self.contacts.append(contact)} } catch { print("Error \(error)") } do { try vcard =

View like android's contact screen

不问归期 提交于 2019-12-22 10:03:07
问题 I am developing an application with a large number of elements that must be ordered alphabetically, and I'd like it to have the same look and feel as android's contact list, That is [Letter] <contact> <contact> [Letter] <contact> <contact> <contact> etc. Which is the best way to achieve this same layout? I've seen several tutorials concerning scrollable lists, but this is a bit different. I've looked a bit through android's source code, but if anyone has the answer, it would save me a lot of

Insert RawContact with a specific contactid

青春壹個敷衍的年華 提交于 2019-12-22 09:48:38
问题 I am trying to create a rawcontact in android that has a specific contact id, so it is linked to other rawcontacts with the same contactid (not rawcontactid). The problem is I am unable to insert the Contact_ID into the ContentProviderOpertations. Using the following code return "Insert failed" ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); int id = (int) contactId; String condition = Data.RAW_CONTACT_ID + "=?"; String[] parameters = { "" + id }; try {

Add a photo to a contact

一曲冷凌霜 提交于 2019-12-22 09:39:51
问题 I am trying to add a contact to the phone address book. I have been successful: I added a new contact and assigned a mobile number to it. Now I need add a JPG I have in my resources directory to the contact as the contact photo. I am looking for a tutorial, but can't find any. I need to target old phones, so I need to use the old Contacts API. Can anyone help? ContentValues contact = new ContentValues(); contact.put(People.NAME, "testContact"); Uri insertUri = activity.getContentResolver()

Android Get Group of Contact by ID

狂风中的少年 提交于 2019-12-21 12:55:48
问题 I have a contact ID, how do I get the group the contact is assigned to? I am sure it is something to do with the Contacts.Groups class but I cannot figure it out. 回答1: In GroupMembership.PERSON_ID you have the ID of the Person, and in the same table GroupMembership.GROUP_ID you have the ID of the group. You can retrieve the groups with the Contacts.Groups . Remember that in every "table" there is and unique ID to identify the row. Hope this helps. (Im working on it too) 来源: https:/

Pick Phone Number from contacts

天涯浪子 提交于 2019-12-21 05:32:29
问题 I have doubt in that section. How to replace space between the string, when to get phone number from Contact list? And it's working fine, But some android devices(e.g. Samsung Tab) have spaces added in their contacts. I get number from contact.So I get string 99 99 99999 instead of 99999999. And also, How to eliminate country code from that number. Ex: +91 999999999 instead of 9999999999 or +020 9696854549 instead of 9696854549 I know, remove that space by using .replace(). Is there any other

need help : google, yahoo, hotmail contacts api [closed]

谁说胖子不能爱 提交于 2019-12-21 04:56:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . i want to import addressbook contacts from Gmail, Windows Live, and Yahoo just like Facebook. In facebook, when i click on Windows live importer, a popup comes with a login page of Windows live. how can i do that? can anyone suggest me a tutorial or reading material to learn about that? 回答1: For Gmail, Google

Android popup menu

两盒软妹~` 提交于 2019-12-21 04:36:23
问题 I am making an Android app. I have a list of items displaying. I am looking to create a popup menu just like the one that pops up when you tap the avatar of a contact in the contact list. I have tried looking through the Android reference but can not find it. Has anyone created one of these popup menus? A link to the reference or a code sample is fine. Screenshot of menu: http://www.youchoob.org/pics/popup.jpg 回答1: What you are describing is called a 'Quick Action'. This is actually a user

Account doesn't appear in contacts app settings on device from HTC

懵懂的女人 提交于 2019-12-21 04:33:17
问题 I write my own SyncAdapter based on example in SDK. It should add contacts from external source, and it works perfect in device emulator. But when I run it on HTC Desire after all I can't see my Account in Contacts->Display options Also I tried google's example on Desire and couldn't see them in this list too. Does anyone know any solution? 回答1: I solve it by making my account visible by default. ContentProviderClient client = getContentResolver().acquireContentProviderClient(ContactsContract