大佬教程收集整理的这篇文章主要介绍了android – 在使用联系人选择器时从多个数字的用户中选择一个数字,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的问题是,你必须收集所有的数字,然后要求用户选择一个数字,还是这个功能已经内置到Android中?我希望我只是忘了一个国旗或东西.
Intent intent = new Intent(Intent.ACTION_PICK,ContactsContract.CommonDataKinds.Phone.CONTENT_URI); startActivityForResult(intent,requEST_PICK_CONTACT);
然后,在onActivityResult()中:
Uri result = data.getData(); Log.v(tag,"Got a result: " + result.toString()); // get the phone number id from the Uri String id = result.getLastPathSegment(); // query the phone numbers for the SELEcted phone number id cursor c = getContentResolver().query( Phone.CONTENT_URI,null,Phone._ID + "=?",new String[]{iD},null); int phonEIDx = c.getcolumnIndex(Phone.numbER); if(c.getCount() == 1) { // contact has a single phone number // get the only phone number if(c.moveToFirst()) { phone = c.getString(phonEIDX); Log.v(tag,"Got phone number: " + phonE); loadContacTinfo(phonE); // do something with the phone number } else { Log.w(tag,"No results"); } }
以上是大佬教程为你收集整理的android – 在使用联系人选择器时从多个数字的用户中选择一个数字全部内容,希望文章能够帮你解决android – 在使用联系人选择器时从多个数字的用户中选择一个数字所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。