I have a AsyncTask in which an activity is launched during the doInBackground method:
private class startupTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
Intent intent = new Intent(StartupActivity.this, LoginConnectorActivity.class);
intent.putExtra("account", account);
startActivity(intent);
return null;
}
}
I want to wait for the called activity to finish before letting the AsyncTask finish. What would be the best way to do this?
what you are asking beats the purpose of the
AsyncTask, asAsyncTasksuppose to run asynchronously with other tasks of the app and finish in the background. So if you want to wait while this task finishes then don’t make it aAsyncTask, as simple as that.