0

So I have a RecyclerView containing an ArrayList of downloading files. What's the proper way to retrive that ArrayList from the download service after I quit the activity and start it again? Is bindService() made for this or is there another way?

Kise
  • 2,823
  • 1
  • 24
  • 43
  • Possible duplicate of [How to have Android Service communicate with Activity](http://stackoverflow.com/questions/2463175/how-to-have-android-service-communicate-with-activity) – Doug Stevenson Feb 18 '16 at 05:58
  • No `bindService()` is not made for this. You should probably save the data in database from the service instead of trying to pass it directly to Activity if its not in foreground. After saving the data in db, when the Activity starts check the db for any new data, if it exists load it into the `RecyclerView` – Sharp Edge Feb 18 '16 at 06:08
  • @SharpEdge that's what I'm going with. Thanks. – Kise Feb 18 '16 at 07:00
  • yes, bindService is a good idea to bind to your service and get all the dats you want – pskink Feb 18 '16 at 11:35

1 Answers1

0

No bindService() is not made for this. You should probably save the data in database from the service instead of trying to pass it directly to Activity if its not in foreground.

After saving the data in db, when the Activity starts check the db for any new data, if it exists load it into the RecyclerView

Sharp Edge
  • 4,144
  • 2
  • 27
  • 41