Refresh profile picture in navigation drawer when changing picture from Change profile snippet

I have an Android app that has 4 fragments with a navigation drawer with a pic profile, but the thing is when I change / update the pic profile in Edit Fragment, the pic profile is updated in that snippet and also im save pic. URL in general settings (also upload to server), but when I go back to Home Fragment, the profile picture in the navigation drawer is not updated with the last picture. I am using Glide lib. to load the pic profile, this image loads the url which is stored in the general preference. But when I close the app and open the profile picture in the navigation drawer update with the last snapshot taken. I cannot ask the user to close the app and open it when they change their profile in the Edit Profile section. Is there a way to solve this problem?

 //getting image URL from Shared Preferences.
       imgUrl = Prefrences.getProfile_picture(HomeActivity.this);

//loading image in navigation drawer with glide in Main Activity
private void loadImageUrl(String imgUrl) {
    if (imgUrl != null && !imgUrl.isEmpty()) {
                .bitmapTransform(new CircleTransform(this))
    } else { 
       getUserDetails();  <-- this method is called when imgUrl is Null,




source to share

2 answers

Your image is probably being cached by Glide.

Check the first 2 answers here Remove image from cache in Glide library



You can call the nav view to update the data when nav activity is created ....

Separate the data binding part and also call this from onCreate ()

private void updateNavHeaderView(){
View headerView = navigationView.inflateHeaderView(R.layout.nav_header);
        ImageView ivUserProfilePhoto = (ImageView) headerView.findViewById(;
        TextView userName = (TextView) headerView.findViewById(;

        if (user != null && user.getUser_image() != null && !user.getUser_image().equals("")) {
                    .resize(avatarSize, avatarSize)
                    .transform(new CircleTransformation())
        } else {




All Articles