nguyenhoanglam / ImagePicker

A customizable library for selecting images on the device.
Apache License 2.0
598 stars 158 forks source link

need support cannot resolve symbol INTENT_EXTRA_SELECTED_IMAGES #123

Closed iwannoerianto closed 4 years ago

iwannoerianto commented 4 years ago

hello, i just update version 1.4.2 from 1.1.3 but there is error

featuredImages = data.getParcelableArrayListExtra(ImagePickerActivity.INTENT_EXTRA_SELECTED_IMAGES);

cannot resolve symbol INTENT_EXTRA_SELECTED_IMAGES

how to fix

thx

nguyenhoanglam commented 4 years ago

@iwannoerianto Please review the usage because it has been changed since v1.4.2

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    // The last parameter value of shouldHandleResult() is the value you pass to setRequestCode().
    // If you did not call setRequestCode(), you could ignore the last parameter.
    if (ImagePicker.shouldHandleResult(requestCode, resultCode, data, 100)) {
        val images: ArrayList<Image> = ImagePicker.getImages(data)
        // Do stuff with image's path or id. For example:
        for (image in images) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
                val uri = Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, image.id.toString())
                Glide.with(context)
                     .load(uri)
                     .into(imageView)
            } else {
                Glide.with(context)
                     .load(image.path)
                     .into(imageView)
            }
        }
    }
    super.onActivityResult(requestCode, resultCode, data)   // This line is REQUIRED in fragment mode
}