0

I have ArrayList of image URLs and need to show them inside recyclerview. I don't want to use any image loading library(Picasso or Glide). I am using threadpoolexecutor for fetching images (reference from https://stuff.mit.edu/afs/sipb/project/android/docs/training/multiple-threads/communicate-ui.html ).

I have to show images in order as they are in arraylist i.e. first image in the list should take 0th position of recyclerview and second on 1st and so on. For example: User images (grid view) on instagram. Loading images asynchronously (in parallel) but on correct positions of RecyclerAdapter.

I think libraries have handled this thing.If someone can guide me, it would be very helpful.

RahulS
  • 11
  • 6
  • if library saved your effort then why you don't want to use? – Niranj Patel Jan 30 '18 at 12:42
  • @NiranjPatel this question was asked in an interview. If you can tell the logic behind it. I was just giving it a shot. – RahulS Jan 30 '18 at 12:43
  • @RahulS check this ans https://stackoverflow.com/a/44724972/7666442 to load image from url without using any lib – AskNilesh Jan 30 '18 at 12:44
  • @RahulS simpy download image in background and set on ImageView. – Niranj Patel Jan 30 '18 at 12:46
  • Thanks @Nilu ,it worked. One more thing, if some image is taking time to load, how to reserve a space for that position and go to next image url like libraries do. For example image loading in instagram. – RahulS Jan 30 '18 at 12:58
  • @RahulS please check this without library. https://stackoverflow.com/a/43993190/4448617 – Ratilal Chopda Jan 31 '18 at 09:04

0 Answers0