OnActivityMlkit

Home   »   OnActivityMlkit

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)

        if (resultCode != RESULT_CANCELED) {
            if (requestCode == PICK_IMAGE) {
                data?.data?.let {
                    bitmap = null
                    bitmap = getBitmapFromUri(it)
                    Glide.with(this)
                        .load(bitmap)
                        .into(text_image)
                }
            } else if (requestCode == 1) {
                val file = File(currentPhotoPath)
                val photoBitmap = MediaStore.Images.Media.getBitmap(contentResolver, Uri.fromFile(file))
                text_image.setImageBitmap(photoBitmap)
                bitmap = photoBitmap
            }
        }
    }

Leave a Reply

Your email address will not be published. Required fields are marked *