Closed SergeKozhCxagroup closed 2 years ago
Hey @SergeKozhCxagroup welcome, can you reproduce on the sample app?
And/or did you have this?
<activity android:name="com.canhub.cropper.CropImageActivity"
android:theme="@style/Base.Theme.AppCompat"/> <!-- optional (needed if default theme has no action bar) -->
Hi @Canato, it was needed to replace the old library activity (com.theartofdev.edmodo.cropper.CropImageActivity) and it does show the crop action now, thanks! But now I can't get the result of the cropping, can it be because I am using the 3.2.2 lib version?
@SergeKozhCxagroup try to use the latest version of the library
and create a activity contract so you can get the result
class MainActivity {
private val cropImage = registerForActivityResult(CropImageContract()) { result ->
if (result.isSuccessful) {
// use the returned uri
val uriContent = result.uriContent
val uriFilePath = result.getUriFilePath(context) // optional usage
} else {
// an error occurred
val exception = result.error
}
}
private fun startCrop() {
// start picker to get image for cropping and then use the image in cropping activity
cropImage.launch(
options {
setGuidelines(Guidelines.ON)
}
)
//start picker to get image for cropping from only gallery and then use the image in
//cropping activity
cropImage.launch(
options {
setImagePickerContractOptions(
PickImageContractOptions(includeGallery = true, includeCamera = false)
)
}
)
// start cropping activity for pre-acquired image saved on the device and customize settings
cropImage.launch(
options(uri = imageUri) {
setGuidelines(Guidelines.ON)
setOutputCompressFormat(CompressFormat.PNG)
}
)
}
}
Let's keep this mess organised! This issue has been automatically marked as stale
because it has not had recent activity. =( It will be closed if no further activity occurs. Thank you for your contributions.
Hi!. I can't crop an image after I picked it. After image is chosen I see a cropping screen, but there are no actions to do after the area is selected. Can you help with this please?
My code is:
Smartphone :
Lib Version [3.3.5]