android-contacts

Access email-id along with name and phone number from contact list in Android

让人想犯罪 __ 提交于 2019-11-28 12:35:17
问题 Here I am accessing name and phone number from mobile and uploading to server. I am not facing any problem in this. I have made some modifications to access email also. But I am not able to fetch the email. In place of email it is displaying phone number. I have used System.out.print to check the details. Here is my code. DisplayContact public class DisplayContact extends Activity implements OnItemClickListener{ //ArrayList to store name and phone number List<String> name1 = new ArrayList

Android get phone number from contact list

元气小坏坏 提交于 2019-11-28 09:00:23
问题 I have these codes which basically use a ListView to display the names in the contact list and I want to get their phone number when click each single name: final ContentResolver cr = getContentResolver(); final Cursor c = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); myCursorAdapter = new SimpleCursorAdapter(this, R.layout.list_item, c, new String[] {ContactsContract.Contacts.DISPLAY_NAME}, new int[]{R.id.TVRow}, 0); myPhoneList.setAdapter(myCursorAdapter);

Native contact change notification

馋奶兔 提交于 2019-11-28 08:32:37
问题 How can I get callback in my application whenever a contact is added or deleted or changed ? Is there any standard broadcast intent that I can register a BroadcastReceiver for that ? 回答1: No BroadcastReceiver available for notifying contacts changes. You may need to use ContentObserver to get notified. Lots discussions happened to here on how to receive Contacts change notification via ContentObserver. Try searching for it. Another way of getting notified, is by using SyncAdapters. Look into

How to avoid duplicate contact name (data ) while loading contact info to listview?

淺唱寂寞╮ 提交于 2019-11-28 08:26:49
I am populating contact list details to list view successfully. My code: String order = ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " ASC"; Cursor curLog = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,null,null,order); How can I avoid the duplicate data In List view as the contact details is repeating if its joined contact i.e. joined with both phone and Google? . The screen is like I want to select programmatically only 1 name not the both? Any Idea how I can select? Ranjit I have used a rough way to avoid this problem which helped me so much

android vcard string to contact

送分小仙女□ 提交于 2019-11-28 07:47:34
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. an android contact looks suspiciously like a vcard, so i suspect they use vcards internally. I think it's a lot more complicated than using 'vCards internally' especially as vCard is effectively just a text file format making it inefficient to

Get list of contacts belonging to a specific group

大城市里の小女人 提交于 2019-11-28 06:37:09
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.getColumnIndex(ContactsContract.Constacts.DisplayName )); contacts.add(name); } this is what i use and it works

how to create one .vcf file for all the contact in android

点点圈 提交于 2019-11-28 06:31:07
问题 i want to crate one .vcf for all contact using below code . the below code is work fine to crate .vcf file but it storing only one contact. please help me.. import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.ArrayList; import android.app.Activity; import android.content.res.AssetFileDescriptor; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider

Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord in Android Studio

自作多情 提交于 2019-11-28 06:15:47
I am getting this error when I am trying to read contacts from phone and I included READ_CONTACTS permission in Manifest file. And the strange thing is that it was working fine in Eclipse but when I converted my project to Gradle and run it in Android Studio I'm getting this error. logcat says: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{302f069 29282:com.GP/u0a322} (pid=29282, uid=10322) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS here is the Manifest code: <uses-sdk android:minSdkVersion="14"

How to show sync failed message

一曲冷凌霜 提交于 2019-11-28 05:34:36
问题 I've build a contacts sync adapter. It's all working fine but I need one more thing. If for some reason the sync does not complete successfully, I want to show a message like Google account is showing when the sync fails 回答1: The solution was to set the delay on the sync result. After this delay the sync will be restarted. try { DO THE SYNCHRONIZATION } catch (AuthenticationException e) { Log.e(TAG, "AuthenticationException"); syncResult.stats.numAuthExceptions++; syncResult.delayUntil = 180;

Broadcast Intent on contact added/edited/changed - android

删除回忆录丶 提交于 2019-11-28 05:34:14
问题 In my app, I have a service in which I want to listen for any changes in contacts i.e., when any contact is added or edited in the native contacts app or through any other app. Is there any broadcast intent which I can register to for this purpose? Or is there any other way to achieve this? 回答1: Found someone with a similar problem, his solution was using RawContacts. Broadcast on contact add/change? http://developer.android.com/reference/android/provider/ContactsContract.RawContacts.html 来源: