0

I'm building a download manager app which can download multiples in parallel. I'm showing the downloading files in a listview where each item has a progressbar showing the download progress.

When a file is dowloaded I want to remove that item from the list. I'm sending progress from service class using localbroadcast manager and updating the list using broadcast receiver.

When a item is removed the app crushes showing IndexOutOfBounds Exception saying index is 1 size is 1.

How can I solve it ?

Rainmaker
  • 10,294
  • 9
  • 54
  • 89
Inan Mahmud
  • 226
  • 3
  • 14

1 Answers1

0

Your list indexing starts with 0. If you have one element in a list you should access it at index 0 like this

list.get(0); //the first element is received
Rainmaker
  • 10,294
  • 9
  • 54
  • 89