android-contacts

Export the Contacts as VCF file

北城以北 提交于 2019-12-17 07:15:23
问题 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? 回答1: 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

Modifying contact information

别等时光非礼了梦想. 提交于 2019-12-17 06:38:25
问题 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

Search contact by phone number

限于喜欢 提交于 2019-12-17 05:50:09
问题 In my app, user writes a phone number, and I want to find the contact name with that phone number? I usually search the contacts like this: Cursor cur = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); But I do this to access all contacts... In this app I only want to get the contact name of the given phone number... How can I restrict the query? Or do I have to go trough all contacts and see if any has the given phone number? But I believe that this

Read all contacts' phone numbers in android

拟墨画扇 提交于 2019-12-16 22:40:34
问题 I'm using this code to retrieve all contact names and phone numbers: String[] projection = new String[] { People.NAME, People.NUMBER }; Cursor c = ctx.getContentResolver().query(People.CONTENT_URI, projection, null, null, People.NAME + " ASC"); c.moveToFirst(); int nameCol = c.getColumnIndex(People.NAME); int numCol = c.getColumnIndex(People.NUMBER); int nContacts = c.getCount(); do { // Do something } while(c.moveToNext()); However, this will only return the primary number for each contact,

Read all contacts' phone numbers in android

与世无争的帅哥 提交于 2019-12-16 22:40:08
问题 I'm using this code to retrieve all contact names and phone numbers: String[] projection = new String[] { People.NAME, People.NUMBER }; Cursor c = ctx.getContentResolver().query(People.CONTENT_URI, projection, null, null, People.NAME + " ASC"); c.moveToFirst(); int nameCol = c.getColumnIndex(People.NAME); int numCol = c.getColumnIndex(People.NUMBER); int nContacts = c.getCount(); do { // Do something } while(c.moveToNext()); However, this will only return the primary number for each contact,

How to get contact id after add a new contact in android?

本小妞迷上赌 提交于 2019-12-14 03:36:25
问题 I use following code for new contacts added to phone. private static void addContact(Account account, String name, String username,String phone,String email) { Log.i(TAG, "Adding contact: " + name); ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>(); ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(RawContacts.CONTENT_URI); builder.withValue(RawContacts.ACCOUNT_NAME, account.name); builder.withValue(RawContacts.ACCOUNT

App crashing on buttonclick how can I solved it android studio

安稳与你 提交于 2019-12-14 03:35:39
问题 Here is the code: button.setOnClickListener(new View.OnClickListener() { @Override public void onClick (View view){ Intent contactPickerIntent = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Phone.CONTENT_URI); startActivityForResult(contactPickerIntent, RESULT_PICK_CONTACT); } }); return view;} public void but(View v) { Intent contactPickerIntent = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Phone.CONTENT_URI); startActivityForResult(contactPickerIntent,

Whats the fastest way to create large numbers of contacts?

大憨熊 提交于 2019-12-14 03:19:42
问题 In my application i need to create a great amount of contacts. The code I currenly use: ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); ops.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI) .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, accounts[0].type) .withValue(ContactsContract.RawContacts.ACCOUNT_NAME, accounts[0].name) .build()); ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)

Android- Loading Contacts with ViewHolder and AsyncTask- Thumbnail issue

纵然是瞬间 提交于 2019-12-13 15:03:07
问题 I am creating a custom contact app.. I use a ArrayAdapter with ViewHolder design pattern for optimization...Since it took a lot of time to load the thumbnail pics, I use AsyncTask class for loading images, for the first set of contacts in my screen, the pics are loading well but when I scroll down, the same set of pictures are being re-cycled at random for other contacts...I have searched this forumn and found a few solutions but none worked for me. I shall put my code below.. Someone pls

How to get full contact from device in to chech box name which can be selectable

半腔热情 提交于 2019-12-13 12:45:08
问题 Hello I am new on android development and I am struggling badly with coding...I have to get full contact list of my device in to dynamic growing checkbox name which can be selectable .... It must be selected already and also which will grow dynamically I have tried a lot of things already but dont find any answers...and I have to get the selected contacted from it on button press public void fetchContacts() { String phoneNumber = null; LayoutInflater layoutInflater = (LayoutInflater)