android-contacts

Pick a Number and Name From Contacts List in android app

。_饼干妹妹 提交于 2019-11-27 04:05:11
i want to pick a contact with it's number from my contacts list. i read a lot of solutions and research for couple weeks but all of articles didn't work properly. some codes like following: Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, PICK_CONTACT); // and in activityresult: if (resultCode == Activity.RESULT_OK) { Uri contactData = data.getData(); Cursor c = managedQuery(contactData, null, null, null, null); if (c.moveToFirst()) { String name = c.getString(c.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));

Export the Contacts as VCF file

怎甘沉沦 提交于 2019-11-27 03:36:22
I want to export the Phone contacts to External storage area. I didn't work with this type of method. Anyone guide me to do this? sam_k In your code, you wrote one function but from where is this function called? And what is the meaning of get(View view) function? This function is not being called so it can be removed. I've edited my answer as per your requirements and tested it with 500 Contacts to save a single vCard file with 500 contacts in my sd card. package com.vcard; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.ArrayList; import

android vcard string to contact

依然范特西╮ 提交于 2019-11-27 02:03:36
问题 i'm wondering if there's a clean way to import a vcard as an android contact. i have a vcard parser, but mapping each possible vcard field and field type is going to be a painful, bug-prone exercise. is there a better way? an android contact looks suspiciously like a vcard, so i suspect they use vcards internally. there's no public API for this however. 回答1: an android contact looks suspiciously like a vcard, so i suspect they use vcards internally. I think it's a lot more complicated than

Get list of contacts belonging to a specific group

好久不见. 提交于 2019-11-27 01:30:49
问题 Does anybody know how to get a list of contacts belonging to a 1 specific group in Android? I need something like this: Select * from contacts where group_id = "1234" I am able to get a list of all contacts OR all groups by using something like this: Cursor groupCursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); final ArrayList<String> contacts = new ArrayList<String>(); while(groupCursor.moveToNext()) { String name = groupCursor.getString(groupCursor

Modifying contact information

青春壹個敷衍的年華 提交于 2019-11-27 01:08:24
I'm trying to insert and update a piece of information on an existing contact so I've created a sample application in order to develop the functionality. All I want my sample app to do is to insert (or if present) update an email address on a contact. I'm selecting a contact through the system Intent like so: startActivityForResult(new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI), PICK_CONTACT_REQUEST); The URI which is returned is that of the Contact ( RawContact ?) which was selected and comes in this form: content://com.android.contacts/contacts/lookup/0r2-2A90214945/2 . I can pull back

MultiAutoCompleteTextView with contacts phone numbers

天大地大妈咪最大 提交于 2019-11-26 23:40:37
问题 I need to create a MultiAutoCompleteTextView with the phone numbers of the contacts on a user's device. What I need is similar to gmail; except with gmail email addresses are used. For the contacts, I have the following needs: each phone number must be an entry. So if John has 3 numbers (home, cell, work), they show as 3 entries each entry is searchable by phone number or by first/last name of person To create my adapter, I try to modify the one provided by Google but when I download the

Group By in ContentResolver in Ice Cream Sandwich

房东的猫 提交于 2019-11-26 23:13:32
问题 I am making a query on the Android Contacts ContentProvider. I need a Group By clause. In Gingerbread and Honeycomb, I do something like this to search phone numbers and emails at the same time: (The actual WHERE clause is much more complicated as it includes types checks. This is a simplification, but it yields the same result) String request = Phone.NUMBER + " LIKE ? OR " + Email.DATA + " LIKE ?"; String[] params = new String["%test%", "%test%"]; Cursor cursor = getContentResolver().query(

Possible to get “Owner” contact info in Android?

我只是一个虾纸丫 提交于 2019-11-26 22:59:09
问题 I haven't been able to find a straight answer on this. Can anyone tell me if it's possible to get the contact info of the phone's owner in an Android App? 回答1: I have found a very easy way (got it from digging into the 4.1 Messaging app!) projection for cursor is final String[] SELF_PROJECTION = new String[] { Phone._ID,Phone.DISPLAY_NAME, }; Cursor is : Cursor cursor = activity.getContentResolver().query(Profile.CONTENT_URI, SELF_PROJECTION, null, null, null); now just do a simple cursor

Get specific contact information from URI returned from Intent.ACTION_PICK

谁说胖子不能爱 提交于 2019-11-26 22:55:25
问题 I am writing an Android app that has a data type that represents a person (specifically, the parent or guardian of a child). I'd like to be able to "import" the relevant data fields from the Contacts database in the Android device. (This should be optional; that is, it will not be a requirement that the parent/guardian is already in the Contacts database, nor will the Contacts database be updated if they add new parents/guardians.) So far, I have written code to start a new Intent to choose

How to remove a contact programmatically in android

被刻印的时光 ゝ 提交于 2019-11-26 22:14:30
I try the following code to remove contact with a specified number: private void removeContact(Context context, String phone) { //context.getContentResolver().delete(Contacts.Phones.CONTENT_URI, phone, null); context.getContentResolver().delete(Contacts.Phones.CONTENT_URI, Contacts.PhonesColumns.NUMBER+"=?", new String[] {phone}); } But I get this exception: java.lang.UnsupportedOperationException: Cannot delete that URL: content://contacts/phones at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:130) at android.database.DatabaseUtils.readExceptionFromParcel