Advertisement
mjollnir357

Untitled

Dec 20th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.61 KB | None | 0 0
  1. private fun renderContact(uri: Uri?) {
  2.     val contactNameView = findViewById<TextView>(R.id.contact_name)
  3.     val contactPhoneView = findViewById<TextView>(R.id.contact_phone)
  4.     val contactPhotoView = findViewById<ImageView>(R.id.contact_portrait)
  5.  
  6.     val name = uri?.let { getDisplayName(it, contentResolver) } ?: "Select a contact"
  7.     val number = uri?.let { getMobileNumber(it, contentResolver) } ?: ""
  8.     val photo = uri?.let { getPhoto(it, contentResolver)}
  9.  
  10.     contactNameView.setText(name)
  11.     contactPhoneView.setText(number)
  12.     contactPhotoView.setImageBitmap(photo)
  13.  
  14. } // fun renderContact
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement