contacts

Custom Contact Ringtone Not Working on Some devices

你说的曾经没有我的故事 提交于 2020-01-21 10:15:10
问题 I'm developing music player, in that i have to set audio file as ringtone for contacts. Below code is working for some phones and some phones not. public static int setContactRingtone(@NonNull Context context, @NonNull Song song, String number) { int value = 0; if (context == null) { value = 0; } File f = new File(song.getmSongPath()); final Uri lookupUri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, number); final String[] projection = new String[] {

Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord in Android Studio

为君一笑 提交于 2020-01-19 07:10:46
问题 I am getting this error when I am trying to read contacts from phone and I included READ_CONTACTS permission in Manifest file. And the strange thing is that it was working fine in Eclipse but when I converted my project to Gradle and run it in Android Studio I'm getting this error. logcat says: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{302f069 29282:com.GP/u0a322} (pid=29282, uid=10322) requires android.permission.READ_CONTACTS or

Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord in Android Studio

半城伤御伤魂 提交于 2020-01-19 07:09:41
问题 I am getting this error when I am trying to read contacts from phone and I included READ_CONTACTS permission in Manifest file. And the strange thing is that it was working fine in Eclipse but when I converted my project to Gradle and run it in Android Studio I'm getting this error. logcat says: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{302f069 29282:com.GP/u0a322} (pid=29282, uid=10322) requires android.permission.READ_CONTACTS or

laravel 控制器类DB类操作

巧了我就是萌 提交于 2020-01-19 03:01:42
从数据表中取得所有的数据列 $users = DB::table('users')->get(); foreach ($users as $user) { var_dump($user->name); } 从数据表中分块查找数据列 DB::table('users')->chunk(100, function($users) { foreach ($users as $user) { // } }); 通过在 闭包 中返回 false 来停止处理接下来的数据列: DB::table('users')->chunk(100, function($users) { // return false; }); 从数据表中取得单一数据列 $user = DB::table('users')->where('name', 'John')->first(); var_dump($user->name); 从数据表中取得单一数据列的单一字段 $name = DB::table('users')->where('name', 'John')->pluck('name'); 取得单一字段值的列表 $roles = DB::table('roles')->lists('title'); 这个方法将会返回数据表 role 的 title 字段值的数组。你也可以通过下面的方法,为返回的数组指定自定义键值。

Save and load Contacts when swapping Activities

爷,独闯天下 提交于 2020-01-17 05:01:05
问题 Hey guys maybe someone of you can help me: What im doing: I have a button in my ContactView that lets me select a phonecontact and inserts name and phonenumber into textviews. The Problem I have is that when i swap between MainActivity and ContactActivity the Contact is deleted and i need to select again a contact Here is my ContactView code public class ContactView extends AppCompatActivity { private static final int RESULT_PICK_CONTACT = 85; private TextView textView1; private TextView

Android Contact Phone Numbers fetching Duplication

心不动则不痛 提交于 2020-01-17 03:37:47
问题 I can fetch contacts and Phone Numbers of each contact but Phone Numbers are duplicate I think there is some option to show contacts linked with other apps like Viber etc so contact are retrieving duplicated How can I avoid picking Duplicate Numbers of each contact ? 回答1: Try this Intent intent = new Intent(Intent.ACTION_PICK,ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, 3); @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {

Android Contact Phone Numbers fetching Duplication

时光毁灭记忆、已成空白 提交于 2020-01-17 03:37:07
问题 I can fetch contacts and Phone Numbers of each contact but Phone Numbers are duplicate I think there is some option to show contacts linked with other apps like Viber etc so contact are retrieving duplicated How can I avoid picking Duplicate Numbers of each contact ? 回答1: Try this Intent intent = new Intent(Intent.ACTION_PICK,ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, 3); @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {

Add Contact photo in android

不打扰是莪最后的温柔 提交于 2020-01-15 04:29:47
问题 I want to add a contact in the android contacts list.I am able to pass the contact no,name and other detail successfully.I am facing problem with the profile pic.How to pass a profile pic for the contact ? 回答1: You have to use ContactsContract.CommonDataKinds.Photo in your traditional insert or using ContentProviderOperation and also provide the photo (as a byte array for example). Just refer to the official doc for some examples. Basically the code with using ContentValues will look

Failure to delete entire contact using ContentProviderOperation

一个人想着一个人 提交于 2020-01-15 02:37:28
问题 I have been working with Android contacts. I am able to show them, update but when I want to delete any, it is not deleted completely. In Contacts application is shown as (Unknown) without any data. Here is my example: ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); ops.add(ContentProviderOperation.newDelete(Data.CONTENT_URI) .withSelection(Data.CONTACT_ID + "=?", new String[]{selectedid}) .build()); getContentResolver().applyBatch(ContactsContract

Contact picker that shows number, contact name and possibly a contact image?

ぐ巨炮叔叔 提交于 2020-01-14 02:53:05
问题 Is there any way to display contact picker that has both number and contact name? Now I'm calling picker: startActivityForResult( new Intent(Intent.ACTION_PICK,Contacts.Phones.CONTENT_URI), 1); But in a result I get only Contact names without visible numbers. To make things worse, if one contact has two numbers it occurs twice. 回答1: try this. its just like the contact picker, but lists clickable phone numbers under the contacts name Intent intent = new Intent(Intent.ACTION_PICK, Contacts