Erel, thanks for your reply.
I am really pulling my hair out because if this :sign0085:
Possibly I am already thinking so much about this problem, that I can't see the easiest solution...
I have now worked with downloading asynchronously, but now I run into the problem of "java.util.concurrent.RejectedExecutionException" because I now have too many connections (~ 28).
I am doing some kind of batch processing here, so downloading a JSON-File from the internet, taking out informations line by line and processing them.
For each line: First I insert stuff into a DB and then I need to download a picture and save it to the device and do stuff with the info from the current line and picture.
The problem is, I don't know how I can wait for a successful download before I continue working with the next line.
My preferred way would be:
- Download JSON-File:
1) Read the next line
2) Add stuff to the DB
3) Download the picture
4) Wait for the Download to complete
5) Work with the data of the current line of the JSON-File AND the picture
6) Goto 1)
:sign0085:
Thanks a lot for any help!
Best regards,
Christian