android-contacts

Android. to display contacts as list view

吃可爱长大的小学妹 提交于 2019-12-03 06:30:45
I want to display contacts in list view and add actions on all contacts , like on click on a particular contact it should display the phone number , mail id and delete of the particular contact... import android.app.ListActivity; import android.content.ContentResolver; import android.database.Cursor; import android.os.Bundle; import android.provider.ContactsContract; import android.view.Menu; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class CPDemo1 extends ListActivity {

Display custom sync adapter as an option when adding contacts

☆樱花仙子☆ 提交于 2019-12-03 04:05:49
I am writing a custom sync adapter following the example in the SDK sample, and things seem to be working well. I can sync back contacts from my server and have them appear in the Contacts app. However, I am unable to add a contact directly to my server. Specifically, I want my sync adapter to appear as an option in the Spinner on the add contact screen, in addition to Google and Corporate, as shown in the screenshot. I couldn't find anything on the interwebs that talks about this. Ok I figured it out. Turns out the contacts.xml file defining a ContactsAccountType that ships with the SDK

Android: Get updated and deleted contact only

一世执手 提交于 2019-12-03 03:41:34
I am developing an application in which i am working on Android Contacts and not able to move ahead. In app the need of application is that the contact which is updated should send to server or the contact which is deleted should send to server for sync. I am using the contact service as: public class ContactService extends Service { private int mContactCount; Cursor cursor = null; static ContentResolver mContentResolver = null; // Content provider authority public static final String AUTHORITY = "com.android.contacts"; // Account typek public static final String ACCOUNT_TYPE = "com.example

Android Contacts provider get only phone contacts with all emails

微笑、不失礼 提交于 2019-12-03 03:13:44
问题 I need to get all phone contacts and their email address and photo uri: This is what am doing: private void getContacts() { ContentResolver cr = getContentResolver(); Cursor cur = cr.query(Contacts.CONTENT_URI, null, null, null, Contacts.DISPLAY_NAME); if (cur.getCount() > 0) { while (cur.moveToNext()) { // if // (Integer.parseInt(cur.getString(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) // > 0) { Contact contact = new Contact(); String id = cur.getString(cur

How to create a contact programmatically [duplicate]

柔情痞子 提交于 2019-12-03 00:53:05
This question already has answers here : How to add new contacts in android (5 answers) Possible Duplicate: How to add new contacts in android public boolean createContact(String name, String number, String email) { boolean success = true; try { ContentValues contentValues = new ContentValues(); ContentResolver contentResolver = getContentResolver(); contentValues.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE); contentValues.put(Phone.NUMBER, "123254"); Uri uri = contentResolver.insert(android.provider.ContactsContract.Data.CONTENT_URI, contentValues); if(uri==null) { success = false; } } catch

Want to create a new group in contacts programmatically

风流意气都作罢 提交于 2019-12-03 00:40:15
I want to create a new contact group. I can query the group and display all the group names but I can't create a group in android I tried as creating contacts method but not created... ContentResolver cr = this.getContentResolver(); groupValues = new ContentValues(); Log.e("Group","start"); groupValues.put(android.provider.Contacts.GroupMembership.GROUP_ID, 4); groupValues.put(android.provider.Contacts.GroupMembership.NAME, "Sriseshaa"); groupValues.put(android.provider.Contacts.GroupMembership.PERSON_ID, 1); cr.insert(android.provider.Contacts.GroupMembership.CONTENT_URI, groupValues); i

How to get all contacts from phonebook & SIM card in Android?

独自空忆成欢 提交于 2019-12-02 21:28:49
I am working to get all the contacts from phone book and SIM card in my application. I want to store those all contacts in my application SQLite DB. The code with which I am working is working fine in normal conditions. Getting problem in below conditions: with a contact without name, that is only number. Contacts from SIM card. These 2 types of contacts, are not provided to me by my code. I am using the below code: public void getDefaultContactsToDB(){ CallBackDatabase callbackDB = new CallBackDatabase(RequestCallBack.this); callbackDB.open(); //clean the database before entering new values.

Understanding architecture of Android contacts

五迷三道 提交于 2019-12-02 20:31:03
I am developing an Android app which needs to know when a contact is added/updated/deleted. So I read several posts for it. I understand that we can get notified through Content observers whenever a contacts gets changed, but we can't get which contacts have been added/updated/deleted. So I have read the official APIs and prepared my design how to capture that particular contact. So what I thought at the start We will store all the contact IDs, deleted flag and version Whenever contacts get changed I will get my table's row count and row count from Android's system. If my rowcount is less than

Custom Search for contacts in android

前提是你 提交于 2019-12-02 20:02:41
问题 I want to custom search in contacts in android. For example, i want contacts that each contact number end with 555 so how can i do that? 回答1: Get all contacts and search manually using code. ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); String phone = null; if (cur.getCount() > 0) { while (cur.moveToNext()) { String id = cur.getString(cur .getColumnIndex(ContactsContract.Contacts._ID)); if (Integer .parseInt

How to add postal address to contacts in android programmaticaly?

◇◆丶佛笑我妖孽 提交于 2019-12-02 18:39:39
问题 I am developing app which add contact info to android contact list .to How to add postal address to contacts in android programmatically ? 回答1: Postal address are stored like all the other info in the DATA table with a MIMEtype == ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE Please google ContactsContract.CommonDataKinds.StructuredPostal to find all the info. If you need to know how to edit a contact in general I would suggest you to have a look to the SampleSyncAdapter