I want to execute multiple tasks at once. I wonder what is the maximum number of tasks I can add in a single Tasks.
Here is an example:
Tasks.whenAllSuccess(tasks)
.addOnCompleteListener(new OnCompleteListener<List<Object>>() {
@Override
public void onComplete(@NonNull Task<List<Object>> task) {
helper.dismissProgressDialog();
if(task.isSuccessful()){
Toast.makeText(context, "Deleted", Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(context, task.getException().getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
CodePudding user response:
There is no hard-coded maximum number of tasks that the Tasks
library can handle (as far as I know). There is probably a physical limit that the device you run the code on can handle (based on memory usage) or that your user is willing to wait (based on the time it takes to execute the tasks), but there's no way for the Tasks
library to know that.