android-contacts

Add one contact with multiple numbers Android programmatically

青春壹個敷衍的年華 提交于 2019-12-30 13:01:10
问题 How to add one contact with multiple numbers on android phone programmatically? 回答1: This is how we can do this pass Name and Array of numbers to this method. public static void addToContactList(Context context, String strDisplayName, String[] strNumber) throws Exception { ArrayList<ContentProviderOperation> cntProOper = new ArrayList<>(); int contactIndex = cntProOper.size();//ContactSize ContentResolver contactHelper = context.getContentResolver(); cntProOper.add(ContentProviderOperation

Android - cant get phone number of some contacts

≯℡__Kan透↙ 提交于 2019-12-30 11:49:50
问题 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

How to get contact number from contactlist in Android?

橙三吉。 提交于 2019-12-30 05:08:21
问题 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,

How do I get my custom account type to show up in the android contacts app?

折月煮酒 提交于 2019-12-30 04:42:07
问题 I've created a custom account type and I can successfully create contacts of that type in the android ContactsContract ContentProvider. But I'm having a lot of trouble figuring out how to get my custom account label and icon to show up when editing the contact in the default contacts app. When editing a custom contact type, the label should be something like " contact", with your app's icon to the right. Instead, editing contacts of my type always show a label of "Phone-only, unsynced contact

Get Contact by Phone number on Android

断了今生、忘了曾经 提交于 2019-12-29 08:27:31
问题 I know how I can get all contacts in Android , and how to get their phone number. What I cant seem to figure out is how to get a contact by phone number... This is my current piece of code I wrote to test which phone numbers are available: // Create a cursor Cursor cursor = Base.contentResover().query(Phone.CONTENT_URI, null, null, null, null); if (cursor.moveToNext()) { Log.d("CALLOG", cursor.getString(cursor.getColumnIndexOrThrow(Phone.NUMBER))); } The problem is that i only get a few phone

Get first and last name of a contact rather than single display name?

北城余情 提交于 2019-12-29 06:16:10
问题 I am currently working with the Android Contacts content provider and currently can access a contacts full display name without issue using the following code: String[] PROJECTION = new String[] { ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.Contacts.HAS_PHONE_NUMBER, }; String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; String SELECTION = "LOWER(" + ContactsContract.Contacts.DISPLAY_NAME + ")" + " LIKE '" +

AutoComplete with name and number as in native sms app Android

北城以北 提交于 2019-12-29 05:38:04
问题 I want to add an AutoCompleteTextView in my app and search contacts by name and number as done in the native SMS app with android. I have looked on the internet and tried quite a few things, but I want my application to display it exactly as the android SMS app. Here is the code I am trying that searches only by Display_Name . public class MakePayment extends Activity { private AutoCompleteTextView mAuto; /** Called when the activity is first created. */ @Override public void onCreate(Bundle

How to get a contact's facebook id or url from native contacts / content resolver?

江枫思渺然 提交于 2019-12-28 04:19:09
问题 How to get the facebook id or url of a contacts that's been synced to the native contacts app via Facebook sync adapter? I went through different urls, but didn't see any info regarding facebook. I tried ContactsContract.Data.CONTENT_URI ContactsContract.CommonDataKinds.Email.CONTENT_URI ContactsContract.CommonDataKinds.Phone.CONTENT_URI ContactsContract.Contacts.CONTENT_URI as URIs already in the code below: Uri uri = ContactsContract.Data.CONTENT_URI; Cursor c = getContentResolver().query

Getting Name,Phone Number and Email Address From Phone Contacts [closed]

北城余情 提交于 2019-12-25 20:49:11
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I needed to Create a project that getting the Name,Phone Number and Email Address from a selected contact from the Phones Default contact list. Steps: When I clicked a button in my application it will open or go to the default phone contact. After that I select a phone contact it will comes back to my

How to fetch recent and favourite contacts in android?

为君一笑 提交于 2019-12-25 09:19:59
问题 I have been trying to fetch recent and favorites contacts but every time i get error . i am storing contacts in database after fetching . cannot read column -1 and sometimes it says cursor not initialized properly. please help me . Here is my code. ContentResolver cr = getActivity().getContentResolver(); /* Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null );*/ Cursor cur=cr.query(CallLog.Calls.CONTENT_URI,null,CallLog.Calls.DATE, null,null); String phone =