RecyclerView and Picasso images disappear after scrollingStrange behaviour of images in RecyclerViewRecyclerView disappearing imagesAndroid Image disappear in RecyclerView after Scrolling list up and down?Lazy load of images in ListViewHow to scale an Image in ImageView to keep the aspect ratioShow Image View from file path?Resize image to full width and fixed height with PicassoRecyclerView onClickHow to add dividers and spaces between items in RecyclerView?Why doesn't RecyclerView have onItemClickListener()?android: create circular image with picassoHow to create RecyclerView with multiple view type?Search Firestore query don't show data in RecycleView

How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)

Domain expired, GoDaddy holds it and is asking more money

How to answer pointed "are you quitting" questioning when I don't want them to suspect

Why airport relocation isn't done gradually?

Does the average primeness of natural numbers tend to zero?

extract characters between two commas?

How can I add custom success page

Symmetry in quantum mechanics

New order #4: World

Need help identifying/translating a plaque in Tangier, Morocco

What do the Banks children have against barley water?

Landing in very high winds

What to wear for invited talk in Canada

Can a planet have a different gravitational pull depending on its location in orbit around its sun?

Extreme, but not acceptable situation and I can't start the work tomorrow morning

What is it called when one voice type sings a 'solo'?

Why do UK politicians seemingly ignore opinion polls on Brexit?

Denied boarding due to overcrowding, Sparpreis ticket. What are my rights?

Finding files for which a command fails

Map list to bin numbers

Can I find out the caloric content of bread by dehydrating it?

Typesetting a double Over Dot on top of a symbol

How would photo IDs work for shapeshifters?

Lied on resume at previous job



RecyclerView and Picasso images disappear after scrolling


Strange behaviour of images in RecyclerViewRecyclerView disappearing imagesAndroid Image disappear in RecyclerView after Scrolling list up and down?Lazy load of images in ListViewHow to scale an Image in ImageView to keep the aspect ratioShow Image View from file path?Resize image to full width and fixed height with PicassoRecyclerView onClickHow to add dividers and spaces between items in RecyclerView?Why doesn't RecyclerView have onItemClickListener()?android: create circular image with picassoHow to create RecyclerView with multiple view type?Search Firestore query don't show data in RecycleView






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I didn't find an answer here, here and here.



I have an activity that shows list of posts (with or without images). When I scroll down and scroll up or refresh the list using SwipeRefreshLayout some of the images may disapper. I use RecyclerView to show list of posts and Picasso to load images. Here is my adapter binding:



@Override
public void onBindViewHolder(ItemViewHolder holder, int position)
// <...>
if (item.getPhoto() != null)
Picasso.with(context)
.load(item.getPhoto())
.into(holder.mPostPhoto);
else
holder.mPostPhoto.setImageDrawable(null);
holder.mPostPhoto.setVisibility(View.GONE);




I send HTTP request to get posts and when I have new data I call PostsAdapter:



public void addAll(List<PostResponse> items) 
this.items.clear();
this.items.addAll(items);

notifyDataSetChanged();



In MainActivity:



@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// <...>
mPostAdapter = new PostAdapter();
mPosts.setLayoutManager(new LinearLayoutManager(MainActivity.this));
mPosts.setAdapter(mPostAdapter);

mPostsSwipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
@Override
public void onRefresh()
updatePosts();

);

updatePosts();


private void updatePosts()
new Api(this).getPosts(new GetPostsCallback(this)
@Override
public void onSuccess(final Paging<PostResponse> paging)
runOnUiThread(new Runnable()
@Override
public void run()
mPostAdapter.addAll(paging.getData());
mPostsSwipeRefresh.setRefreshing(false);

);

);



I find it's pretty basic, I don't understand why images disappear time after time. My list is not long and images resized before the upload to the server, they shouldn't use much memory. And the worst, when they disappear, they don't reload. They may reload only after I scroll down and up...



  • Please explain me why it happens.

  • How can I fix this problem?

Thanks!










share|improve this question
























  • it is hard to say why is this happening with the code you posted. Could you share a little bit more ? Do you have any specific configuration policy for picasso?

    – Blackbelt
    Nov 5 '16 at 18:04











  • @Blackbelt please see an update. I don't have any specific configuration for anything. It's very basic: get posts from the server, each post has image url, use picasso to load image to ImageView by url.

    – Andrei
    Nov 5 '16 at 18:19











  • it looks good - if you log item.getPhoto() ?

    – Blackbelt
    Nov 5 '16 at 18:24











  • @Blackbelt I checked item.getPhoto() it's there...

    – Andrei
    Nov 5 '16 at 18:27

















1















I didn't find an answer here, here and here.



I have an activity that shows list of posts (with or without images). When I scroll down and scroll up or refresh the list using SwipeRefreshLayout some of the images may disapper. I use RecyclerView to show list of posts and Picasso to load images. Here is my adapter binding:



@Override
public void onBindViewHolder(ItemViewHolder holder, int position)
// <...>
if (item.getPhoto() != null)
Picasso.with(context)
.load(item.getPhoto())
.into(holder.mPostPhoto);
else
holder.mPostPhoto.setImageDrawable(null);
holder.mPostPhoto.setVisibility(View.GONE);




I send HTTP request to get posts and when I have new data I call PostsAdapter:



public void addAll(List<PostResponse> items) 
this.items.clear();
this.items.addAll(items);

notifyDataSetChanged();



In MainActivity:



@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// <...>
mPostAdapter = new PostAdapter();
mPosts.setLayoutManager(new LinearLayoutManager(MainActivity.this));
mPosts.setAdapter(mPostAdapter);

mPostsSwipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
@Override
public void onRefresh()
updatePosts();

);

updatePosts();


private void updatePosts()
new Api(this).getPosts(new GetPostsCallback(this)
@Override
public void onSuccess(final Paging<PostResponse> paging)
runOnUiThread(new Runnable()
@Override
public void run()
mPostAdapter.addAll(paging.getData());
mPostsSwipeRefresh.setRefreshing(false);

);

);



I find it's pretty basic, I don't understand why images disappear time after time. My list is not long and images resized before the upload to the server, they shouldn't use much memory. And the worst, when they disappear, they don't reload. They may reload only after I scroll down and up...



  • Please explain me why it happens.

  • How can I fix this problem?

Thanks!










share|improve this question
























  • it is hard to say why is this happening with the code you posted. Could you share a little bit more ? Do you have any specific configuration policy for picasso?

    – Blackbelt
    Nov 5 '16 at 18:04











  • @Blackbelt please see an update. I don't have any specific configuration for anything. It's very basic: get posts from the server, each post has image url, use picasso to load image to ImageView by url.

    – Andrei
    Nov 5 '16 at 18:19











  • it looks good - if you log item.getPhoto() ?

    – Blackbelt
    Nov 5 '16 at 18:24











  • @Blackbelt I checked item.getPhoto() it's there...

    – Andrei
    Nov 5 '16 at 18:27













1












1








1








I didn't find an answer here, here and here.



I have an activity that shows list of posts (with or without images). When I scroll down and scroll up or refresh the list using SwipeRefreshLayout some of the images may disapper. I use RecyclerView to show list of posts and Picasso to load images. Here is my adapter binding:



@Override
public void onBindViewHolder(ItemViewHolder holder, int position)
// <...>
if (item.getPhoto() != null)
Picasso.with(context)
.load(item.getPhoto())
.into(holder.mPostPhoto);
else
holder.mPostPhoto.setImageDrawable(null);
holder.mPostPhoto.setVisibility(View.GONE);




I send HTTP request to get posts and when I have new data I call PostsAdapter:



public void addAll(List<PostResponse> items) 
this.items.clear();
this.items.addAll(items);

notifyDataSetChanged();



In MainActivity:



@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// <...>
mPostAdapter = new PostAdapter();
mPosts.setLayoutManager(new LinearLayoutManager(MainActivity.this));
mPosts.setAdapter(mPostAdapter);

mPostsSwipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
@Override
public void onRefresh()
updatePosts();

);

updatePosts();


private void updatePosts()
new Api(this).getPosts(new GetPostsCallback(this)
@Override
public void onSuccess(final Paging<PostResponse> paging)
runOnUiThread(new Runnable()
@Override
public void run()
mPostAdapter.addAll(paging.getData());
mPostsSwipeRefresh.setRefreshing(false);

);

);



I find it's pretty basic, I don't understand why images disappear time after time. My list is not long and images resized before the upload to the server, they shouldn't use much memory. And the worst, when they disappear, they don't reload. They may reload only after I scroll down and up...



  • Please explain me why it happens.

  • How can I fix this problem?

Thanks!










share|improve this question
















I didn't find an answer here, here and here.



I have an activity that shows list of posts (with or without images). When I scroll down and scroll up or refresh the list using SwipeRefreshLayout some of the images may disapper. I use RecyclerView to show list of posts and Picasso to load images. Here is my adapter binding:



@Override
public void onBindViewHolder(ItemViewHolder holder, int position)
// <...>
if (item.getPhoto() != null)
Picasso.with(context)
.load(item.getPhoto())
.into(holder.mPostPhoto);
else
holder.mPostPhoto.setImageDrawable(null);
holder.mPostPhoto.setVisibility(View.GONE);




I send HTTP request to get posts and when I have new data I call PostsAdapter:



public void addAll(List<PostResponse> items) 
this.items.clear();
this.items.addAll(items);

notifyDataSetChanged();



In MainActivity:



@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// <...>
mPostAdapter = new PostAdapter();
mPosts.setLayoutManager(new LinearLayoutManager(MainActivity.this));
mPosts.setAdapter(mPostAdapter);

mPostsSwipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
@Override
public void onRefresh()
updatePosts();

);

updatePosts();


private void updatePosts()
new Api(this).getPosts(new GetPostsCallback(this)
@Override
public void onSuccess(final Paging<PostResponse> paging)
runOnUiThread(new Runnable()
@Override
public void run()
mPostAdapter.addAll(paging.getData());
mPostsSwipeRefresh.setRefreshing(false);

);

);



I find it's pretty basic, I don't understand why images disappear time after time. My list is not long and images resized before the upload to the server, they shouldn't use much memory. And the worst, when they disappear, they don't reload. They may reload only after I scroll down and up...



  • Please explain me why it happens.

  • How can I fix this problem?

Thanks!







android imageview android-recyclerview android-imageview picasso






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 23 '17 at 10:27









Community

11




11










asked Nov 5 '16 at 17:30









AndreiAndrei

22.6k27107159




22.6k27107159












  • it is hard to say why is this happening with the code you posted. Could you share a little bit more ? Do you have any specific configuration policy for picasso?

    – Blackbelt
    Nov 5 '16 at 18:04











  • @Blackbelt please see an update. I don't have any specific configuration for anything. It's very basic: get posts from the server, each post has image url, use picasso to load image to ImageView by url.

    – Andrei
    Nov 5 '16 at 18:19











  • it looks good - if you log item.getPhoto() ?

    – Blackbelt
    Nov 5 '16 at 18:24











  • @Blackbelt I checked item.getPhoto() it's there...

    – Andrei
    Nov 5 '16 at 18:27

















  • it is hard to say why is this happening with the code you posted. Could you share a little bit more ? Do you have any specific configuration policy for picasso?

    – Blackbelt
    Nov 5 '16 at 18:04











  • @Blackbelt please see an update. I don't have any specific configuration for anything. It's very basic: get posts from the server, each post has image url, use picasso to load image to ImageView by url.

    – Andrei
    Nov 5 '16 at 18:19











  • it looks good - if you log item.getPhoto() ?

    – Blackbelt
    Nov 5 '16 at 18:24











  • @Blackbelt I checked item.getPhoto() it's there...

    – Andrei
    Nov 5 '16 at 18:27
















it is hard to say why is this happening with the code you posted. Could you share a little bit more ? Do you have any specific configuration policy for picasso?

– Blackbelt
Nov 5 '16 at 18:04





it is hard to say why is this happening with the code you posted. Could you share a little bit more ? Do you have any specific configuration policy for picasso?

– Blackbelt
Nov 5 '16 at 18:04













@Blackbelt please see an update. I don't have any specific configuration for anything. It's very basic: get posts from the server, each post has image url, use picasso to load image to ImageView by url.

– Andrei
Nov 5 '16 at 18:19





@Blackbelt please see an update. I don't have any specific configuration for anything. It's very basic: get posts from the server, each post has image url, use picasso to load image to ImageView by url.

– Andrei
Nov 5 '16 at 18:19













it looks good - if you log item.getPhoto() ?

– Blackbelt
Nov 5 '16 at 18:24





it looks good - if you log item.getPhoto() ?

– Blackbelt
Nov 5 '16 at 18:24













@Blackbelt I checked item.getPhoto() it's there...

– Andrei
Nov 5 '16 at 18:27





@Blackbelt I checked item.getPhoto() it's there...

– Andrei
Nov 5 '16 at 18:27












5 Answers
5






active

oldest

votes


















5














I ran into this issue as well, but didn't want to disable the recycling. I found that by explicitly setting the ImageView visibility to View.VISIBLE before making the call to Picasso, the images loaded even after scrolling:



holder.image.setVisibility(View.VISIBLE);
Picasso.with(context)
.load(imgUrl)
.into(holder.image);





share|improve this answer

























  • this is the right answer , please accept it so that others know it works

    – Kaustubh Bhagwat
    Sep 21 '17 at 8:51











  • @Billy Brawner, man thank you so much.. you saved my day! This should be the correct answer

    – Shahriar Siraj Snigdho
    Oct 20 '17 at 18:51











  • doesn't work for me..

    – Eswar
    Nov 30 '18 at 10:37


















0














So, apparently RecyclerView was recycling items from my list and for some reason it couldn't reload images after that. Good question "why?"... Maybe because I did something wrong, not sure. This helped me:



recyclerView.getRecycledViewPool().setMaxRecycledViews(0, 0);


Basically you are turning off items recycling. It works for me because I don't render huge lists of items.






share|improve this answer























  • why would you even use recycler view if you don't want to recycle things

    – Huzefa Gadi
    Mar 1 at 11:26












  • @HuzefaGadi I do want to use recyclerView. The issue is that it doesn't work as expected..

    – Andrei
    Mar 1 at 14:17


















0














If you are using if condition in adapter then try below code



 if (model.image == null || model.equals(""))
viewHolder.ivIndieImage.setVisibility(View.GONE);
else
viewHolder.ivIndieImage.setVisibility(View.VISIBLE);



try to setVisibility visible of the image.






share|improve this answer
































    0














    You missed one thing in the onBindViewHolder. In the else part you are changing the visibility to View.GONE but in the If part you are not making it visible again. So, in recycler view the views are getting recycled means there data is getting changed but If you modify any property it will remain same for that view and it will be seen in the other items that are being shown using the same recycled view.






    share|improve this answer






























      0














      I was able to fix this issue by removing the resize and center crop methods of the same, somehow they were taking too much memory and it was leading to messing up the image loading process






      share|improve this answer























        Your Answer






        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "1"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f40441176%2frecyclerview-and-picasso-images-disappear-after-scrolling%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        5














        I ran into this issue as well, but didn't want to disable the recycling. I found that by explicitly setting the ImageView visibility to View.VISIBLE before making the call to Picasso, the images loaded even after scrolling:



        holder.image.setVisibility(View.VISIBLE);
        Picasso.with(context)
        .load(imgUrl)
        .into(holder.image);





        share|improve this answer

























        • this is the right answer , please accept it so that others know it works

          – Kaustubh Bhagwat
          Sep 21 '17 at 8:51











        • @Billy Brawner, man thank you so much.. you saved my day! This should be the correct answer

          – Shahriar Siraj Snigdho
          Oct 20 '17 at 18:51











        • doesn't work for me..

          – Eswar
          Nov 30 '18 at 10:37















        5














        I ran into this issue as well, but didn't want to disable the recycling. I found that by explicitly setting the ImageView visibility to View.VISIBLE before making the call to Picasso, the images loaded even after scrolling:



        holder.image.setVisibility(View.VISIBLE);
        Picasso.with(context)
        .load(imgUrl)
        .into(holder.image);





        share|improve this answer

























        • this is the right answer , please accept it so that others know it works

          – Kaustubh Bhagwat
          Sep 21 '17 at 8:51











        • @Billy Brawner, man thank you so much.. you saved my day! This should be the correct answer

          – Shahriar Siraj Snigdho
          Oct 20 '17 at 18:51











        • doesn't work for me..

          – Eswar
          Nov 30 '18 at 10:37













        5












        5








        5







        I ran into this issue as well, but didn't want to disable the recycling. I found that by explicitly setting the ImageView visibility to View.VISIBLE before making the call to Picasso, the images loaded even after scrolling:



        holder.image.setVisibility(View.VISIBLE);
        Picasso.with(context)
        .load(imgUrl)
        .into(holder.image);





        share|improve this answer















        I ran into this issue as well, but didn't want to disable the recycling. I found that by explicitly setting the ImageView visibility to View.VISIBLE before making the call to Picasso, the images loaded even after scrolling:



        holder.image.setVisibility(View.VISIBLE);
        Picasso.with(context)
        .load(imgUrl)
        .into(holder.image);






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Oct 12 '18 at 14:38

























        answered Sep 10 '17 at 15:39









        Billy BrawnerBilly Brawner

        37946




        37946












        • this is the right answer , please accept it so that others know it works

          – Kaustubh Bhagwat
          Sep 21 '17 at 8:51











        • @Billy Brawner, man thank you so much.. you saved my day! This should be the correct answer

          – Shahriar Siraj Snigdho
          Oct 20 '17 at 18:51











        • doesn't work for me..

          – Eswar
          Nov 30 '18 at 10:37

















        • this is the right answer , please accept it so that others know it works

          – Kaustubh Bhagwat
          Sep 21 '17 at 8:51











        • @Billy Brawner, man thank you so much.. you saved my day! This should be the correct answer

          – Shahriar Siraj Snigdho
          Oct 20 '17 at 18:51











        • doesn't work for me..

          – Eswar
          Nov 30 '18 at 10:37
















        this is the right answer , please accept it so that others know it works

        – Kaustubh Bhagwat
        Sep 21 '17 at 8:51





        this is the right answer , please accept it so that others know it works

        – Kaustubh Bhagwat
        Sep 21 '17 at 8:51













        @Billy Brawner, man thank you so much.. you saved my day! This should be the correct answer

        – Shahriar Siraj Snigdho
        Oct 20 '17 at 18:51





        @Billy Brawner, man thank you so much.. you saved my day! This should be the correct answer

        – Shahriar Siraj Snigdho
        Oct 20 '17 at 18:51













        doesn't work for me..

        – Eswar
        Nov 30 '18 at 10:37





        doesn't work for me..

        – Eswar
        Nov 30 '18 at 10:37













        0














        So, apparently RecyclerView was recycling items from my list and for some reason it couldn't reload images after that. Good question "why?"... Maybe because I did something wrong, not sure. This helped me:



        recyclerView.getRecycledViewPool().setMaxRecycledViews(0, 0);


        Basically you are turning off items recycling. It works for me because I don't render huge lists of items.






        share|improve this answer























        • why would you even use recycler view if you don't want to recycle things

          – Huzefa Gadi
          Mar 1 at 11:26












        • @HuzefaGadi I do want to use recyclerView. The issue is that it doesn't work as expected..

          – Andrei
          Mar 1 at 14:17















        0














        So, apparently RecyclerView was recycling items from my list and for some reason it couldn't reload images after that. Good question "why?"... Maybe because I did something wrong, not sure. This helped me:



        recyclerView.getRecycledViewPool().setMaxRecycledViews(0, 0);


        Basically you are turning off items recycling. It works for me because I don't render huge lists of items.






        share|improve this answer























        • why would you even use recycler view if you don't want to recycle things

          – Huzefa Gadi
          Mar 1 at 11:26












        • @HuzefaGadi I do want to use recyclerView. The issue is that it doesn't work as expected..

          – Andrei
          Mar 1 at 14:17













        0












        0








        0







        So, apparently RecyclerView was recycling items from my list and for some reason it couldn't reload images after that. Good question "why?"... Maybe because I did something wrong, not sure. This helped me:



        recyclerView.getRecycledViewPool().setMaxRecycledViews(0, 0);


        Basically you are turning off items recycling. It works for me because I don't render huge lists of items.






        share|improve this answer













        So, apparently RecyclerView was recycling items from my list and for some reason it couldn't reload images after that. Good question "why?"... Maybe because I did something wrong, not sure. This helped me:



        recyclerView.getRecycledViewPool().setMaxRecycledViews(0, 0);


        Basically you are turning off items recycling. It works for me because I don't render huge lists of items.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 6 '16 at 2:33









        AndreiAndrei

        22.6k27107159




        22.6k27107159












        • why would you even use recycler view if you don't want to recycle things

          – Huzefa Gadi
          Mar 1 at 11:26












        • @HuzefaGadi I do want to use recyclerView. The issue is that it doesn't work as expected..

          – Andrei
          Mar 1 at 14:17

















        • why would you even use recycler view if you don't want to recycle things

          – Huzefa Gadi
          Mar 1 at 11:26












        • @HuzefaGadi I do want to use recyclerView. The issue is that it doesn't work as expected..

          – Andrei
          Mar 1 at 14:17
















        why would you even use recycler view if you don't want to recycle things

        – Huzefa Gadi
        Mar 1 at 11:26






        why would you even use recycler view if you don't want to recycle things

        – Huzefa Gadi
        Mar 1 at 11:26














        @HuzefaGadi I do want to use recyclerView. The issue is that it doesn't work as expected..

        – Andrei
        Mar 1 at 14:17





        @HuzefaGadi I do want to use recyclerView. The issue is that it doesn't work as expected..

        – Andrei
        Mar 1 at 14:17











        0














        If you are using if condition in adapter then try below code



         if (model.image == null || model.equals(""))
        viewHolder.ivIndieImage.setVisibility(View.GONE);
        else
        viewHolder.ivIndieImage.setVisibility(View.VISIBLE);



        try to setVisibility visible of the image.






        share|improve this answer





























          0














          If you are using if condition in adapter then try below code



           if (model.image == null || model.equals(""))
          viewHolder.ivIndieImage.setVisibility(View.GONE);
          else
          viewHolder.ivIndieImage.setVisibility(View.VISIBLE);



          try to setVisibility visible of the image.






          share|improve this answer



























            0












            0








            0







            If you are using if condition in adapter then try below code



             if (model.image == null || model.equals(""))
            viewHolder.ivIndieImage.setVisibility(View.GONE);
            else
            viewHolder.ivIndieImage.setVisibility(View.VISIBLE);



            try to setVisibility visible of the image.






            share|improve this answer















            If you are using if condition in adapter then try below code



             if (model.image == null || model.equals(""))
            viewHolder.ivIndieImage.setVisibility(View.GONE);
            else
            viewHolder.ivIndieImage.setVisibility(View.VISIBLE);



            try to setVisibility visible of the image.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Apr 20 '18 at 7:17









            Peter Haddad

            22.7k104459




            22.7k104459










            answered Apr 20 '18 at 6:58









            Rohan LodhiRohan Lodhi

            1,044519




            1,044519





















                0














                You missed one thing in the onBindViewHolder. In the else part you are changing the visibility to View.GONE but in the If part you are not making it visible again. So, in recycler view the views are getting recycled means there data is getting changed but If you modify any property it will remain same for that view and it will be seen in the other items that are being shown using the same recycled view.






                share|improve this answer



























                  0














                  You missed one thing in the onBindViewHolder. In the else part you are changing the visibility to View.GONE but in the If part you are not making it visible again. So, in recycler view the views are getting recycled means there data is getting changed but If you modify any property it will remain same for that view and it will be seen in the other items that are being shown using the same recycled view.






                  share|improve this answer

























                    0












                    0








                    0







                    You missed one thing in the onBindViewHolder. In the else part you are changing the visibility to View.GONE but in the If part you are not making it visible again. So, in recycler view the views are getting recycled means there data is getting changed but If you modify any property it will remain same for that view and it will be seen in the other items that are being shown using the same recycled view.






                    share|improve this answer













                    You missed one thing in the onBindViewHolder. In the else part you are changing the visibility to View.GONE but in the If part you are not making it visible again. So, in recycler view the views are getting recycled means there data is getting changed but If you modify any property it will remain same for that view and it will be seen in the other items that are being shown using the same recycled view.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Apr 20 '18 at 7:24









                    hiten pannuhiten pannu

                    1106




                    1106





















                        0














                        I was able to fix this issue by removing the resize and center crop methods of the same, somehow they were taking too much memory and it was leading to messing up the image loading process






                        share|improve this answer



























                          0














                          I was able to fix this issue by removing the resize and center crop methods of the same, somehow they were taking too much memory and it was leading to messing up the image loading process






                          share|improve this answer

























                            0












                            0








                            0







                            I was able to fix this issue by removing the resize and center crop methods of the same, somehow they were taking too much memory and it was leading to messing up the image loading process






                            share|improve this answer













                            I was able to fix this issue by removing the resize and center crop methods of the same, somehow they were taking too much memory and it was leading to messing up the image loading process







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Mar 8 at 7:20









                            Huzefa GadiHuzefa Gadi

                            869159




                            869159



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f40441176%2frecyclerview-and-picasso-images-disappear-after-scrolling%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                1928 у кіно

                                Захаров Федір Захарович

                                Ель Греко