Artishock
Artishock

Reputation: 131

Android - Loading Bitmaps with AsyncTask inside RecyclerView-Adapter (ViewPager)

I'm asking for your help, once again. I'm writing an app which uses a ViewPager with nested RecyclerView. I'm loading some pictures, so the UI is pretty slow, while waiting for them to load. Especially, when the Internet connection is not good. I tought to use the AsyncTask, but can't get it to communicate with the "onBindViewHolder"-method to place the Bitmap.

You'll find the code for example here. How can I let the ressources load in Background in this case? I'd greatly appreciate any help or advice.

[EDIT] Could I load the entire ViewHolder or execute the onBindViewHolder in Background?

Upvotes: 0

Views: 815

Answers (1)

jwBurnside
jwBurnside

Reputation: 867

I use Picasso for loading images (http://square.github.io/picasso/), and it seems to work very well. You should be able to replace your AsyncTasks with it if I'm understanding your question correctly. It also provides the ability to display a placeholder image in case of slow connections.

Upvotes: 1

Related Questions