contactscontract

Getting Contact Phone Number

故事扮演 提交于 2019-12-01 06:33:32
问题 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 2.2 Contact Birthday Date

自闭症网瘾萝莉.ら 提交于 2019-12-01 06:17:14
问题 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

android edit contact

混江龙づ霸主 提交于 2019-12-01 02:57:53
hi im trying to add a phone number to an existing contact on android 2.1. Im currently using: ContentValues values = new ContentValues(); values.put(Phone.RAW_CONTACT_ID,cursor.getColumnIndex(Phone.CONTACT_ID)); String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '1'"; ContentResolver cr = getContentResolver(); Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI,null, selection, null,ContactsContract.Contacts.DISPLAY_NAME+" COLLATE LOCALIZED ASC"); if (cursor.getCount() > 0) { cursor.moveToPosition(oldcontactid); contactid = cursor.getString(cursor.getColumnIndex

android edit contact

孤者浪人 提交于 2019-11-30 23:52:05
问题 hi im trying to add a phone number to an existing contact on android 2.1. Im currently using: ContentValues values = new ContentValues(); values.put(Phone.RAW_CONTACT_ID,cursor.getColumnIndex(Phone.CONTACT_ID)); String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '1'"; ContentResolver cr = getContentResolver(); Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI,null, selection, null,ContactsContract.Contacts.DISPLAY_NAME+" COLLATE LOCALIZED ASC"); if (cursor

Reading all contact data

一曲冷凌霜 提交于 2019-11-30 14:04:38
问题 I am on Android 2.3.3, API Level 10. I want to read all contacts and data associated to them, therefore e.g. all email addresses, phone numbers, custom fields... I tried it like this: Uri contactUri = ContactsContract.Contacts.CONTENT_URI; Cursor contacts = managedQuery(contactUri, null, null, null, null ); contacts.moveToFirst(); do { for(int i=0;i<contacts.getColumnCount();i++) { System.out.println(contacts.getColumnName(i) + ": " + contacts.getString(i)); } System.out.println("============

How do implicit joined columns work with Android contacts data?

笑着哭i 提交于 2019-11-30 11:05:29
I'm querying the ContactsContract.Data table to find phone records. I get an error when I create a new CursorLoader : java.lang.IllegalArgumentException: Invalid column deleted My code: import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Data; ... String[] projection = { Phone.DELETED, Phone.LOOKUP_KEY, Phone.NUMBER, Phone.TYPE, Phone.LABEL, Data.MIMETYPE, Data.DISPLAY_NAME_PRIMARY }; // "mimetype = ? AND deleted = ?" String selection = Data.MIMETYPE + " = ? AND " Phone.DELETED + " = ?"; String[] args = {Phone.CONTENT_ITEM_TYPE, "0"}; return

Reading all contact data

蓝咒 提交于 2019-11-30 09:14:40
I am on Android 2.3.3, API Level 10. I want to read all contacts and data associated to them, therefore e.g. all email addresses, phone numbers, custom fields... I tried it like this: Uri contactUri = ContactsContract.Contacts.CONTENT_URI; Cursor contacts = managedQuery(contactUri, null, null, null, null ); contacts.moveToFirst(); do { for(int i=0;i<contacts.getColumnCount();i++) { System.out.println(contacts.getColumnName(i) + ": " + contacts.getString(i)); } System.out.println("============\n\n"); } while (contacts.moveToNext()); contacts.close(); However this gives me only the following

Get Postal address from a contact using ContactsContract api on android

坚强是说给别人听的谎言 提交于 2019-11-30 07:39:47
问题 I am using ContactsContract api intent for showing all contacts from an activity. This intent returns an id of the contact. I need to get the postal address of this contact. Here is the code which i am using for showing contacts: Intent intent = new Intent(Intent.ACTION_PICK); intent.setType(ContactsContract.Contacts.CONTENT_TYPE); startActivityForResult(intent, PICK_CONTACT); I am getting the result in the onActivityResult function. Please help, how do i do this. 回答1: in your

How to get all contacts first name, last name, email, phone number, etc without duplicates

元气小坏坏 提交于 2019-11-30 06:38:51
问题 I am trying to get details of all the contacts available in phone contacts using below code. But facing small issue of duplicate values. EDITED ACTUAL CODE STARTS :- private String refreshData() { String emaildata = ""; try { ContentResolver cr = getBaseContext().getContentResolver(); String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '" + ("1") + "'"; String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; Cursor cur = cr .query(ContactsContract

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

人盡茶涼 提交于 2019-11-29 18:03:29
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<String>(); List<String> phno1 = new ArrayList<String>(); List<String> email1 = new ArrayList<String>();