In one activity I have three AsyncTask objects AsyncTask
final ContentLoadTask initializeAct = new ContentLoadTask(this); initializeAct.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); final GetImagesUrlTask imagesUrlTask = new GetImagesUrlTask(this); imagesUrlTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); final GetComments getCommentsTask = new GetComments(this); getCommentsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); one of which calls the function
public void RetrieveImages(String... urls) { for (String url : urls) { PhotoRetrieveTask task = new PhotoRetrieveTask(this); task.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, url); } } Is it possible to do that? Is this technically correct? And the third getCommentsTask does not execute doInBackground
Plus, I read that cancel() does not always work correctly, but since I understand, you need to terminate the thread manually after it does what I need. And then the threads limit will be released and the last, third thread will be executed.