In Android Studio, I can get to change an image in Firebase Storage.
But When I run app again, the old image still in cache and is loaded on ImageView, even I link new image with Firebase directly.
Is there someone with this same problem which could help me?
P.S.: I can save the image in Firebase Storage.
My code is:
But When I run app again, the old image still in cache and is loaded on ImageView, even I link new image with Firebase directly.
Is there someone with this same problem which could help me?
P.S.: I can save the image in Firebase Storage.
My code is:
Java:
public static void changePhoto(final Context context, String pUserId, Intent pData){
Uri urlPhoto = pData.getData();
StorageReference mStorage;
Bundle extras = pData.getExtras();
Bitmap bmp = (Bitmap) extras.get("data");
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.WEBP, 100, bos);
String imageEncoded = Base64.encodeToString(bos.toByteArray(), Base64.DEFAULT);
mStorage = FirebaseStorage.
getInstance().
getReference(pUserId + "/" + pUserId + ".webp");
mStorage.putBytes(bos.toByteArray()).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Toast.makeText(context, "Ok. Photo uploaded with success.",Toast.LENGTH_LONG).show();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(context, "!!! Error !!!",Toast.LENGTH_LONG).show();
}
});
}
Last edited: