niksn niksn - 1 year ago 68
Android Question

Firebase UI - View doesnt Update

Im using Glide from the Firebase UI to link an ImageView to my Firebase Storage. Now it works fine but Im currently implementing an update where users can change their Profileimage, the imagename and path stays the same. Either my english is to weak to understand the documentation from Glide or there simply isnt a way to recognize updates by Glide. I read something about Requests here but I cant figure it out.

Set the ref right:

this.profileRef = this.mStorageRef.child("images").child(FirebaseAuth.getInstance()

Calling the function onCreate:

.using(new FirebaseImageLoader())

But dont know how to tell Glide to update the Image, in the Code below I just get frustrated and tried to set the Glide again, but as awaited it didnt do anything, the ImageView is still loading the Cache Picture. Also nothing happens when I tried Glide.clear(view). Maybe somebody faced this Problem already can help me.

profileRef.putFile(file).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
.using(new FirebaseImageLoader())

Answer Source

Solved it after a while. Glide cant recognize changes, if the name stays the same or the URL stays the same. So you must invalidate the Cache by putting a signature on to your Picture. Read here more about it:

    Glide.with(getContext() /* context */)
            .using(new FirebaseImageLoader())
            .signature(new StringSignature(getCurrentTimeStamp()))

public static String getCurrentTimeStamp(){
    try {

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String currentDateTime = dateFormat.format(new Date()); // Find todays date

        return currentDateTime;
    } catch (Exception e) {

        return null;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download