android-contacts

Custom fields on new contact

穿精又带淫゛_ 提交于 2019-11-28 05:11:52
问题 This is the 'add new contact' window. Is it possible to create custom data fields in this window? My current custom fields are only visible on the 'contact details' window. 回答1: It is possible to launch a new Add New Contact activity when the user clicks on the add new contact button. For that you will have to create your own activity and setContentView(R.layout.YOUR_CUSTOM_ACTIVITY_SCREEN) . Now the next step is important. Add the following lines to the ManifestFile of your application:

How to get Contact ID, Email, Phone number in one SQLite query ? Contacts Android Optimization

耗尽温柔 提交于 2019-11-28 04:11:34
I want to fetch All Contacts atleast with one phone Number, also I want all Phone Numbers and All emails for every Contact. Current code : // To get All Contacts having atleast one phone number. Uri uri = ContactsContract.Contacts.CONTENT_URI; String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + " > ?"; String[] selectionArgs = new String[] {"0"}; Cursor cu = applicationContext.getContentResolver().query(uri, null, selection, selectionArgs, null); // For getting All Phone Numbers and Emails further queries : while(cu.moveToNext()){ String id = cu.getString(cu.getColumnIndex

Edit name/phone number of contact programmatically

旧时模样 提交于 2019-11-28 03:21:54
问题 I am trying to modify displayed name of a contact programmatically: try { ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); ops.add(ContentProviderOperation.newUpdate(Data.CONTENT_URI) .withSelection(ContactsContract.CommonDataKinds.Phone._ID + " = ?", new String[] {contact_id}) .withValue(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, "anything") .build()); ContentProviderResult[] result = getContentResolver().applyBatch(ContactsContract.AUTHORITY,

MultiAutoCompleteTextView with contacts phone numbers

放肆的年华 提交于 2019-11-28 02:17:34
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 sample, it does not compile (kind of a crappy experience when the thing is right out of the box, but I am

using checkbox to filter contacts and get phone number

空扰寡人 提交于 2019-11-28 02:03:49
I am working on an app that works similar to the default text messaging app on all Android phones. My problem is selecting more than one user to send an SMS message to. What I have done so far is stored my contacts as listview items with check boxes. Now I just need to get the phone numbers from the selected contacts. So what I am having trouble on doing. 1) Pulling a phone number from the contacts displayed in my listview 2)displaying that number in a textview in a new activity Sorry if my code is difficult to understand, please ask if you need clerification. This is the XML in which the

get Email Address from contact list

折月煮酒 提交于 2019-11-28 01:48:04
问题 I getting contact list by permission android:name="android.permission.READ_CONTACTS" Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, PICK_CONTACT); but how to get Email address from public void onActivityResult(int reqCode, int resultCode, Intent data) { //what should i have to write to fetch email address of selected contact // I wrote like below but i could not get result if (resultCode == Activity.RESULT_OK) { try{ Uri

Getting Contact ID from Android Contacts database is not working as intended

谁说我不能喝 提交于 2019-11-28 01:23:12
问题 I have the following code. int phoneContactID = new Random().nextInt(); Cursor contactLookupCursor = context.getContentResolver().query( Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,Uri.encode(contactNumber)), new String[] {PhoneLookup.DISPLAY_NAME, PhoneLookup._ID},null,null,null); try { contactLookupCursor.moveToFirst(); while(contactLookupCursor.moveToNext()) { phoneContactID = contactLookupCursor.getInt(contactLookupCursor.getColumnIndexOrThrow(PhoneLookup._ID)); } } finally {

Cannot insert android contacts programmatically into android device

大憨熊 提交于 2019-11-27 22:19:37
问题 ArrayList<ContentProviderOperation> ops =new ArrayList<ContentProviderOperation>(); ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI) .withValue(Data.RAW_CONTACT_ID, 3) .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE) .withValue(Phone.NUMBER, "999999999") .withValue(Phone.TYPE, Phone.TYPE_CUSTOM) .withValue(Phone.DISPLAY_NAME, "hhhhhhh") .withValue(ContactsContract.CommonDataKinds.Email.DATA, "abcd@gmail.com") .build()); ops.add(ContentProviderOperation.newInsert

Changing contact's image to a large photo via PHOTO_FILE_ID in Android

会有一股神秘感。 提交于 2019-11-27 22:14:36
问题 This seems to work for small images: ContentValues values = new ContentValues(); values.put(ContactsContract.Data.RAW_CONTACT_ID, id); values.put(ContactsContract.Data.IS_SUPER_PRIMARY, 1); values.put(ContactsContract.CommonDataKinds.Photo.PHOTO, photo); values.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE); if (photoRow >= 0) { context.getContentResolver().update(ContactsContract.Data.CONTENT_URI, values, ContactsContract.Data._ID + " = " +

Android Contact Picker With Checkbox

大兔子大兔子 提交于 2019-11-27 21:39:08
There are a lot of discussions going on about the same subject, but after spending 4 hours here, I could not find a valid description or a link to make a Contact Picker with Checkbox. I have an activity with DONE button and listview with checkbox . I have managed to show the contacts correctly. Now I want to return the selected contact phone numbers in a bundle (I think the best way) so that I can get the list of numbers in onActivityResult() . I am not sure of the way I am following is right or not. Here is my code: public class ContactPickerMulti extends ListActivity implements