0

I am making an app with post feeds and implemented RecyclerViews

But my posts have highquality images consuming much memory when set on imageViews

So its kind of annoying to set the views everytime one scrolls to the post...

How can I not reuse the viewholders already designated?

Moon
  • 133
  • 1
  • 9

1 Answers1

0

First of all am I right that you want to avoid the RecyclerView from recycling inflated views? So if I am right I can tell you that this is the main purpose of the RecyclerView not to inflate new layouts. Instead the RecyclerView reuses already inflated layouts that are currently not used.

As you want to hold all your already inflated Views I recommend you to use a ListView instead of a RecyclerView. AFAIK all your inflated Views will stay.

BUT: There is one little problem. If you want to set many highquality images into your listview then you may be confronted with a memory out of bounds exception if your RAM usage overruns a specific limit (have a look here: memory out of bound exception using high quality images in Gallery).

Maybe the official developer homepage can help you with this topic: https://developer.android.com/training/displaying-bitmaps/cache-bitmap.html

Community
  • 1
  • 1
Michael S.
  • 33
  • 7