android-contacts

How can I retrieve recently used contacts in android?

 ̄綄美尐妖づ 提交于 2019-11-30 15:50:42
问题 I want the list of recently used contacts in my application. Just like in composing a new message there is a list of recently used contact, how can I access those contacts? 回答1: try this code: /* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by

How to get contact number from contactlist in Android?

一笑奈何 提交于 2019-11-30 15:41:26
I want to get contact number from contact list. In Android application on button i want get number from contact list of phone. Means it click on Select button, & open contact list. it select number, & display in textview. Please give me a solution. Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, PICK_CONTACT); @Override public void onActivityResult(int reqCode, int resultCode, Intent data) { super.onActivityResult(reqCode, resultCode, data); switch (reqCode) { case (PICK_CONTACT) : if (resultCode == Activity.RESULT_OK) { Uri

how many contacts in contact list

Deadly 提交于 2019-11-30 15:38:54
问题 How can I tell how many contacts there are in the contact list? I got the contact number, but one person can have more than one contact and I want to account for this in finding the total number of contacts in the contact list. 回答1: To find the count of phone numbers of all the contacts Cursor cursor = managedQuery(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null); int count = cursor.getCount(); To find the count of all the phone numbers of a particular RawContactID

How to show&handle contact details intents of apps?

余生颓废 提交于 2019-11-30 15:20:57
Background Not sure how it's called, but when you open the contact-details screen of the contacts app, you see various apps there that you can click to perform actions on (such as calling and sending messages via Viber and WhatsApp) as such: The problem I don't know how those actions are called, so I can't find out how to investigate them. I tried searching for each social network, how to use it, but this seems like a lot of effort that might not even work well in the future. I wish to query those actions, show them, and handle them, for all of the apps that are shown on the native contacts

how many contacts in contact list

醉酒当歌 提交于 2019-11-30 15:11:22
How can I tell how many contacts there are in the contact list? I got the contact number, but one person can have more than one contact and I want to account for this in finding the total number of contacts in the contact list. To find the count of phone numbers of all the contacts Cursor cursor = managedQuery(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null); int count = cursor.getCount(); To find the count of all the phone numbers of a particular RawContactID (pass the contact id value in rawContactId). Cursor cursor = managedQuery(ContactsContract.CommonDataKinds

Android QuickContactBadge with letters like Android Lollipop

守給你的承諾、 提交于 2019-11-30 15:05:20
I have a list of contacts and I want to show in each contact's QuickContactBadge the first letter of his name. Can I create the images in runtime? This is like Android Lollipop, where contacts and dialer uses QuickContactBadge with letters: I use a function to generate these images. public static Bitmap generateCircleBitmap(Context context, int circleColor, float diameterDP, String text){ final int textColor = 0xffffffff; DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); float diameterPixels = diameterDP * (metrics.densityDpi / 160f); float radiusPixels = diameterPixels/2; //

How to select multiple contacts from the phone using checkboxes

六眼飞鱼酱① 提交于 2019-11-30 14:43:37
I am trying to select contacts available from the phone programmatically and I am using the below code Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE); startActivityForResult(intent, 1); However the question is How can I select multiple contacts at a time by using a checkbox in the contacts page? You will have to read the Contacts programmatically and display them in a ListView in your Activity . Use CheckBox s in the ListView items and allow multiple items to be selected. Find a simple example/tutorial for a

Select multiple contacts from phone book in android

允我心安 提交于 2019-11-30 11:59:16
问题 I need to select contact numbers/emails from phone book in android. I have seen selecting one contact and getting the result back in onActivityResult from this link. But I need multiple contacts to be selected from the phone book. How to achieve this? I don't want to make my custom list, is there a way to use androids built in functionality? 回答1: I am sharing code for select multiple contact from Phone Book. you have change little bit and you can achieve your goal. thanks getAllContacts(this

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

Add a custom field to a phone number

我的梦境 提交于 2019-11-30 10:29:18
Am building an app that requires a custom contact field ('whitelist', if you were wondering) for every phone number. However, I only found a way of saving custom data for each contact, with Data.RAW_CONTACT_ID , but not for each phone number . I tried using Phone._id , but I got a java.nullpointerexception error. This is the code I have now: try{ //phoneId = get Phone._ID from cursor ContentValues values = new ContentValues(); values.put(Data.DATA1, "yes"); int state = getContentResolver().update(Phone.CONTENT_URI, values, Phone._ID + " = " + phoneId + " AND " + Data.MIMETYPE + "='" + MIMETYPE