首页 > 作文

通讯录封面图片设计,如何设计班级通讯录封面

更新时间:2023-03-26 08:18:38 阅读: 评论:0

这几天做个老人桌面,那些系统自带的通讯录,通讯录列表头像太小了,老人看不清。于是自己写一个老人专用通讯录,给联系人设置大头贴,还能语立志歌曲言报名,这样老人就很好找到需要打电话的联系人!

至于通讯录获取头像,网上有很多方法,但是都太乱了!

简介代码

ContentResolver cr = view.getContext().getContentResolver();Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI,Long.parLong(contact.contact_id));InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(cr, uri);Bitmap photo = BitmapFactory.decodeStream(input);

加载到自己的ImageView

Glide.with(context)    .load(Uri.par(item.photo_uri))    .into(R.id.iv_photo))

怎么获取通讯录数据

val uri = ContactsContract.CommonDataKinds.Contactables.CONTENT_URIval PHONE_BOOK_LABEL = "phonebook_label";contactList = ArrayList<ContactBean>()val cursor = contentResolver.query(    uri,    arrayOf(        ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,        ContactsContract.CommonDataKinds.Phone.NUMBER,        ContactsContract.CommonDataKinds.Phone.CONTACT_ID诗歌朗诵 少年强 ,        ContactsCont人十ract.CommonDataKinds.Phone.PHOTO_FILE_ID,        ContactsContract.CommonDataKinds.Phone.PHOTO_ID,        ContactsContract.CommonDataKinds.Phone.PHOTO_THUMBNAIL_URI,        ContactsContract.CommonDataKinds.Phone.PHOTO_URI,        PHONE_BOOK_LABEL    ),    null,    null,    ContactsContract.CommonDataKinds.Phone.SORT_KEY_PRIMARY)if (null != cursor) {    while (cursor.moveToNext()) {        val firstChar =            cursor.getString(cursor.getColumnIndex(PHONE_BOOK_LABEL))        val contact_id =            cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID))        val name =            cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME))    过去将来完成时    val phoneNum =            cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))        val photo_id =            cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_ID))        val photo_file_id =            cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_FILE_ID))        val photo_uri =            cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_URI))        val photo_thumbnail_uri =           cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_THUMBNAIL_URI))        val contact = ContactBean(            firstChar,            contact_id,            name,            phoneNum,            photo_id,            photo_file_id,            photo_uri,            photo_thumbnail_uri        )        contactList!!.add(contact)    }    cursor.clo()

自定义的通讯录实体类:

data class ContactBean(    val firstChar: String? = "",    val contact_id: String? = "",    val name: String? = "",    val phoneNum: String? = "",    val photo_id: String? = "",    val photo_file_id: String? =端午节的诗歌 "",    val photo_uri: String? = "",    val photo_thumbnail_uri: String? = "") {    override fun toString(): String {        return "${firstChar},${name},${contact_id},${phoneNum},${photo_id},${photo_file_id},${photo_uri},${photo_thumbnail_uri}n"    }}

本文发布于:2023-03-26 08:18:37,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/zuowen/d166f0122c1161819d163bc040c16039.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

本文word下载地址:通讯录封面图片设计,如何设计班级通讯录封面.doc

本文 PDF 下载地址:通讯录封面图片设计,如何设计班级通讯录封面.pdf

标签:通讯录   老人   自己的   头像
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图