contactscontract

Showing some contacts multiple times in my App from phone book

故事扮演 提交于 2019-12-02 14:41:06
问题 I'm getting same contact three or two times in my app this happening with some contacts not with every contacts. In my app everything is working as expected but when clicking on show contact from my it's shows three time same contact but in mobile phone contact stored only one time. I tried everything from my side but not able to solve this can any body please help me. Or is there any alternative way for same. Here is my code:- @Override protected Integer doInBackground(Void... params) { try

Showing some contacts multiple times in my App from phone book

非 Y 不嫁゛ 提交于 2019-12-02 08:34:18
I'm getting same contact three or two times in my app this happening with some contacts not with every contacts. In my app everything is working as expected but when clicking on show contact from my it's shows three time same contact but in mobile phone contact stored only one time. I tried everything from my side but not able to solve this can any body please help me. Or is there any alternative way for same. Here is my code:- @Override protected Integer doInBackground(Void... params) { try { db = new WhooshhDB(myContext); this.list = new ArrayList<>(); ContentResolver cr = myContext

Android: Cannot query ContactsContract.Directory on HTC

巧了我就是萌 提交于 2019-12-02 05:57:45
问题 I wrote a sample app that returns contacts data from GAL (company directory, defined as Exchange ActiveSync in "Accounts"). The very same app works perfectly well on a bunch of different devices, but not on HTC I tested with (One X+ with Android 4.1.1 and One VX with 4.0.4). Basically the query to ContactsContract.Directory.CONTENT_URI returns only directories with IDs of Directory.DEFAULT and Directory.LOCAL_INVISIBLE. On other devices this adds, for example, id=5 with type com.android

Save Contacts as “Phone contact”

本秂侑毒 提交于 2019-12-01 13:29:37
Is there way to programmatically adds the contact to the internal phone contacts book as a "phone contact"? I've tried: list.add(ContentProviderOperation .newInsert(ContactsContract.RawContacts.CONTENT_URI) .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null) .withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null) .build()); with this parameters contact successfully saves to the phone, but in case i set up filter to "display phone contacts only" - created contact not appears. btw, i've read that contacts with null type can be loses drying accounts synchronization (haven't remember

Android - cant get phone number of some contacts

那年仲夏 提交于 2019-12-01 12:21:54
I'm having a problem with extracting phone numbers of some people in my contact list. First I show all the contacts in a listview: String[] projection = new String[] { ContactsContract.Contacts._ID, ContactsContract.CommonDataKinds.Phone.CONTACT_ID, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER }; mCursor = mContext.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, projection, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=?", new String[] {mContactId}, null); When clicking on an item, this is how I fetch

Aggregate Contacts are added automatically?

北战南征 提交于 2019-12-01 12:06:52
问题 you must have seen this piece of code somewhere else too,but obviously there's no answer for this exception. EDIT: IF You've come here finding a solution to restoring contacts via vcardio.This is IT!! I got this while utilising the vCardIO api for android used to restore contacts from vcard to the contacts db.I have been using the following doImport() method which is supposed to work just fine,but it isnt! public void doImport(final String fileName, final boolean replace) { try { File vcfFile

Save Contacts as “Phone contact”

走远了吗. 提交于 2019-12-01 11:35:16
问题 Is there way to programmatically adds the contact to the internal phone contacts book as a "phone contact"? I've tried: list.add(ContentProviderOperation .newInsert(ContactsContract.RawContacts.CONTENT_URI) .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null) .withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null) .build()); with this parameters contact successfully saves to the phone, but in case i set up filter to "display phone contacts only" - created contact not appears. btw,

Get contacts with email id

让人想犯罪 __ 提交于 2019-12-01 10:48:59
I need to get contacts information(cursor) with email. They must be distinct. There must be one entry per contact if he has got an email. How to do it? I am targetting new contacts API comes with 2.0. 1)I tried to do it using CursorJoiner, but a strange thing happens. Here is my code : MatrixCursor matCur = new MatrixCursor( new String[]{ Contacts._ID, Contacts.DISPLAY_NAME, "photo_id", "starred" } ); Cursor newContactCursor = managedQuery( ContactsContract.Contacts.CONTENT_URI, new String[]{ Contacts._ID, Contacts.DISPLAY_NAME, "photo_id", "starred" }, null, null, null//Contacts._ID );

Getting Contact Phone Number

穿精又带淫゛_ 提交于 2019-12-01 09:18:12
I am having trouble getting a contact phone number, i keep getting an error in the log cat saying 02-24 19:40:42.772: ERROR/CursorWindow(21467): Bad request for field slot 0,-1. numRows = 1, numColumns = 24 here is my code import android.app.Activity; import android.content.ContentResolver; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.util.Log; import android.view.View; import android.widget.ListView; import android.widget.Button;

Android 2.2 Contact Birthday Date

可紊 提交于 2019-12-01 08:57:39
I am trying to get birthday date from contact details from android 2.2, can someone help me a little bit with the query. Here is my code: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView contactView = (TextView) findViewById(R.id.contactview); Cursor cursor = getContacts(); while (cursor.moveToNext()) { String displayBirthday = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Event.START_DATE)); contactView.append("Birthday: "); contactView.append(displayBirthday); contactView.append("