I have two AsyncTask, the first is for the http request #1 and the other is for another request. I'd like to call one after the other like:
new AsyncCallerTickets().execute();
new AsyncCallerContacts().execute();
Is it possible?
My Tasks are:
private class AsyncCallerTickets extends AsyncTask<Void, Void, Void>
{
SpotsDialog dialog = new SpotsDialog(TicketsDetailsContacts.this, R.style.Custom);
@Override
protected void onPreExecute() {
super.onPreExecute();
dialog.setCancelable(false);
dialog.setMessage(getString(R.string.dialog_wait));
dialog.show();
}
@Override
protected Void doInBackground(Void... params) {
responseStringTickets = mRequestTickets(urlTickets);
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
dialog.dismiss();
}
}
and
private class AsyncCallerContacts extends AsyncTask<Void, Void, Void>
{
SpotsDialog dialog = new SpotsDialog(TicketsDetailsContacts.this, R.style.Custom);
@Override
protected void onPreExecute() {
super.onPreExecute();
dialog.setCancelable(false);
dialog.setMessage(getString(R.string.dialog_wait));
dialog.show();
}
@Override
protected Void doInBackground(Void... params) {
responseStringTickets = mRequestTickets(urlContacts);
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
dialog.dismiss();
}
}
Can someone explain me how I can do? Thanks in advance.