android-contacts

Error in looking up a contact Android

。_饼干妹妹 提交于 2019-12-25 08:59:15
问题 I am getting an error when I want to access the a specific contact. java.lang.IllegalArgumentException: Invalid column contact_id Here is the sample code: String number = "0877777777"; Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number)); String[] projection = new String[]{ ContactsContract.PhoneLookup.CONTACT_ID }; Cursor cur = getActivity().getContentResolver().query(uri, projection, null, null, null); // if other contacts have that phone as

Add app icon on Contact not working in Marshmallow

家住魔仙堡 提交于 2019-12-25 05:51:38
问题 I am adding icon of my app in phonebook. now the problem is that its working fine in Api level < 23 but not working on Api level > 23. in API 23 it creates new Contact with number. in Api 21 in Api 23 String MIMETYPE = "vnd.android.cursor.item/com.appiconincontact"; ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); // insert account name and account type ops.add( ContentProviderOperation .newInsert(addCallerIsSyncAdapterParameter(RawContacts.CONTENT_URI,

Android Contacts on listview

試著忘記壹切 提交于 2019-12-25 05:14:53
问题 I want to add the selected contacts on a listview in my application .I am getting selected code using following code but it is not showing selected contacts on listview .Please help me with what and where I am doing wrong public class Contacts extends Activity implements View.OnClickListener { private Button AddNewContact; private Button AddFrmContacts; private ListView EmergencyContactList; private final int PICK = 1001; private final int NEW = 1002; ArrayList<ContactDetails> ContactList =

List of Mimetypes supported by android contacts

扶醉桌前 提交于 2019-12-24 21:45:57
问题 I am preparing a contact app where i need to get the list of Mimetypes supported by android contacts. For ex: Some devices support SIP address and some devices. So i want to insert SIP address when it is supported then how can check that mimetype is supported. I have found mimetypes table in contacts db of android in com.android.providers.contacts package. How I will be able to access that mimetypes table in contacts2.d b database. Please help. Thank you for your help. 回答1: If you want to

Pick multiple contact with name and phone number

耗尽温柔 提交于 2019-12-24 19:17:29
问题 Currently my code can pick one contact only and display in the selected editText and after button add clicked, the details will inserted into the database.. Now i want to select multiple contact and insert them into the database.What is the best method for me to implement this? Below is my current code. public class newBill extends AppCompatActivity implements View.OnClickListener{ //Defining views private EditText description; private EditText person_engaged; private EditText amount; private

kitkat (API 19) inserting contact?

邮差的信 提交于 2019-12-24 11:49:50
问题 After searching almost the whole Internet already I have a really big headache from this problem. I have a code that works on any APIs, in addition to API 19 KitKat (Google Nexus). It is a typical code for adding/inserting contacts to device. Anyone have any ideas why this does not work right? ArrayList<ContentProviderOperation> op_list = new ArrayList<ContentProviderOperation>(); ContentProviderOperation.Builder builder = ContentProviderOperation .newInsert(RawContacts.CONTENT_URI); builder

Update contact pictures - support other providers like outlook

▼魔方 西西 提交于 2019-12-24 07:26:34
问题 The code at the bottom shows how I update contact pictures from my app. This works well, if the user uses sim, phone and google contacts and similar. But if he uses the outlook app, the outlook app does overwrite the images set by my app again after some time. Can I somehow solve that? Can I force to overwrite the outlook image as well so that outlook syncs my new photo instead of their old one? Code byte[] photo = ImageUtil.convertImageToByteArray(bitmap, true); ContentValues values = new

ContactsContract select records by phone number

风格不统一 提交于 2019-12-24 07:16:02
问题 I can select all contacts using the query below cr = mActivity.getContentResolver(); String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + " > 0"; String orderBy = ContactsContract.Contacts.DISPLAY_NAME + " ASC "; Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, selection, null, orderBy); However, I have a phone number list and I want to create this query like String selection = ContactsContract.Contacts.PhoneNumber_or_something_else in (MyPhoneNumberArray) Is that

how to get 10 -10 contacts from contact in android

此生再无相见时 提交于 2019-12-24 06:58:13
问题 here in my app i need to fetch only 10 contacts and next 10 contacts will fetch when I press next button and so on.. protected String doInBackground(String... args) { i = 0; count = 0; ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); names = new String[cur.getCount()]; phone = new String[cur.getCount()]; if ((cur.getCount() > 0)) { if (count < 5) { while (cur.moveToNext()) { String id = cur.getString(cur

How to get the phone number from selected contact?

二次信任 提交于 2019-12-24 00:59:19
问题 public void onActivityResult(int reqCode, int resultCode, Intent data) { super.onActivityResult(reqCode, resultCode, data); switch (reqCode) { case (1) : if (resultCode == Activity.RESULT_OK) { Uri contactData = data.getData(); Cursor cursor = managedQuery(contactData, null, null, null, null); ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); Cursor phones = cr.query(Phone.CONTENT_URI, null, null, null, null); if