-
-
Notifications
You must be signed in to change notification settings - Fork 991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filters are not working when I use ActivityResultLauncher #419
Comments
I was replacing my functions to startActivityForResult and added orientation logic and I got an error like this. java.lang.IllegalStateException: Software rendering doesn't support hardware bitmaps I googled it and I changed my getBitmapFromUri function like this. Previous fun getBitmapFromUri(imageUri: Uri): Bitmap?
{
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
{
ImageDecoder.decodeBitmap(ImageDecoder.createSource(application.contentResolver, imageUri))
}
else
{
MediaStore.Images.Media.getBitmap(application.contentResolver, imageUri)
}
} Now fun getBitmapFromUriSoftware(imageUri: Uri): Bitmap = let {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
{
return@let ImageDecoder.decodeBitmap(ImageDecoder.createSource(application.contentResolver, imageUri))
{ decoder: ImageDecoder, _: ImageDecoder.ImageInfo?, _: ImageDecoder.Source? ->
decoder.isMutableRequired = true
decoder.allocator = ImageDecoder.ALLOCATOR_SOFTWARE
}
}
BitmapDrawable(application.resources,
MediaStore.Images.Media.getBitmap(application.contentResolver, imageUri)).bitmap
} And it works well without exception. and I tried this way to my ActivityResultLauncher issue as well. https://developer.android.com/reference/android/graphics/ImageDecoder#setMutableRequired(boolean) according to google document
anyways, I think if we use decodeBitmap function, we need to care about this mutable attribution. about IllegalStateException |
This issue is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 4 days. |
comment |
This issue is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 4 days. |
This issue was closed because it has been stalled for 5 days with no activity. |
I'm using PhotoEditor library. I've been really thankful for your PhotoEditor personally.
but while I'm using it, I got an error when I use registerForActivityResult functions
In your project, you're using startActivityForResult functions. when I used them, I didn't get this issue.
but registerForActivityResult are different.
in EditProfileFragment
onCreate
imageProcess function
onCreate in EditImageActivity
startActivityForResult: Camera / gallery => bitmap => EditImageActivity (OK)
registerForActivityResult: Camera / gallery => bitmap => EditImageActivity (I got bitmap but filters are not working)
I'm testing Android API 30 Emulator
Thanks.
The text was updated successfully, but these errors were encountered: