Reputation: 696
For my android app I am currently using Jsoup to connect and extract data from 6 websites, I have put these into 6 methods that execute Sequentially:
getAndExtractWebsite1();
getAndExtractWebsite2();
getAndExtractWebsite3();
etc....
I would like to know how it would be possible to speed up the process of collecting the data from the websites, its currently around 10secs in total. Can these calls be executed in parallel or how do you manage multiple websites when collecting data. Any examples would be welcome. Thank you.
Upvotes: 1
Views: 551
Reputation: 3658
If you want parallel execution, you should look at multithreading.
One way to do this is with AsyncTasks
. By default they run sequentially but you can get them to run in parallel by using a different executor. This is described here.
You can also use the basic java async framework. This is described here.
Upvotes: 3