Hi Gavin, My answer is not specific to android. So please see if this is useful to you, else please ignore.
I assume that you are worried about any user interaction taking place in the middle of this download (as the download take a while, if you follow your first option), and you may not be able to respond to the user request immediately as you are in the middle of a download. If that is what you are looking for then. In my opinion its not a good idea to create thread for every download. You should have only one thread doing download. But after every link is downloaded, you must check if there are any user requests or anything/any event that you need to service. Service that (if it requires attention), then go for the next download. There may be situation where you need to navigate to a previous page, or cancel the download etc. In such a case check for such an event and cancel/come out of this thread. -Ebin On Wed, Jun 10, 2009 at 9:45 AM, Gavin <[email protected]> wrote: > > Hi, > I have a question. > If I have a list which has many url links. I want to download all > url. How should I do? There are two solutions: > 1) use only one thread to download all links. It needs a while > loop. for example, > int i=0; > while(i<list.length){ > download(list[i]); > i++; > } > > 2) create a thread for a link. After the link is downloaded, create > a new thread to next link. Is it good idea? > > Please give me your suggestions. thanks. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

