I have some JSON resources like below
. . .
I am using AsyncTask and requesting each page within my OnPostExecute method and calling doinBackground method of the same class;
@Override
protected void onPostExecute(ArrayList<MyClass> result) {
currentPage++;
if(currentPage == 21){
Intent intent = new Intent(getApplicationContext(), MyActivity.class);
intent.putParcelableArrayListExtra("List", result);
startActivity(intent);
}
else{
new DownloadInfoTask().execute(this.URL + "&page=" + currentPage);
}
}
It seems working for me so far even if each thread is waiting for the previous ones completion. My question is would it be a better approach if i use parallel execution for consuming these kinds of resources and how can i implement parallel execution to my problem?
0 comments:
Post a Comment