
I'm trying to get Image from my Storage and catch error. How to cast this Object to Image?
Code
String currentAvatarFileId = (String) "6468811491b6bba36063Avatar";
Image currentAccountAvatarImage = (Image) storage.getFilePreview(
accountsAvatarBucketId,
currentAvatarFileId,
new Continuation<Object>() {
@NotNull
@Override
public CoroutineContext getContext() {
return EmptyCoroutineContext.INSTANCE;
}
@Override
public void resumeWith(@NotNull Object o) {
try {
if (o instanceof Result.Failure) {
Result.Failure failure =(Result.Failure) o;
throw failure.exception;
} else {
}
} catch (Throwable th) {
Log.e("ERROR", th.toString());
}
}
}
);
Error
java.lang.ClassCastException: kotlin.coroutines.intrinsics.CoroutineSingletons cannot be cast to android.media.Image

I don't think you can assign it like that. You'd have to assign in the coroutinecallback. Also, I'm pretty sure o would be a byte array so you would need to convert the byte array to image

Thanks. I convert it to byte array and it works correctly!

[SOLVED] Get Image from Storage
Recommended threads
- Hola equipo de soporte,
Hola equipo de soporte, Estoy desarrollando una Function en Appwrite Cloud con Node.js 22 y el siguiente package.json: { "name": "upload-whitelist", "type"...
- [Node.js SDK] Bypass 2GB file limit?
Hello. Using either InputFile.fromPath or InputFile.fromBuffer throws this error: File size (2295467305) is greater than 2 GiB Bucket limit etc. is setup corre...
- Hi im using vvs studio to make a charact...
my game involves magic , leveling up aka "phase" max phase is 30 each 10 20 30 theres awakening 1 2 3 i want to make a character builder so that players can fig...
