Are you useing AsyncTask
. After Android 3.0, the default behavior of AsyncTask
is execute in a single thread using SERIAL_EXECUTOR.
If you want AsyncTask
run concurrently on any system version, you may use this code.
AsyncTask task = new YourTask();
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
task.execute(params);
} else {
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
}
Pre OS 1.6 - Multiple Async Tasks gets executed in sequence.
OS 1.6 till OS 2.3 - Async Tasks run in parallel.
From 3.0 - Again, Async Tasks gets executed in sequence.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…