AsyncTask使って非同期で処理してるはずなのになぜか遅い...
どうも裏の処理を待ってるっぽいので調べたら
Starting HONEYCOMB, tasks are back to being executed on a single thread to avoid common application errors caused by parallel execution.
Developers:AsyncTask.execute
Σ(・ω・ノ)ノ
という訳でAndroid 3.0以降は同期処理らしい…orz
If you truly want parallel execution, you can use the executeOnExecutor(Executor, Params...) version of this method with THREAD_POOL_EXECUTOR; however, see commentary there for warnings on its use.
Developers:AsyncTask.execute
とのことなのでこんな感じで修正。
AsyncTask.java
AsyncTask asyncTask = new AsyncTask();
- asyncTask.execute(request);
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
+ asyncTask.execute(request);
+ } else {
+ asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, request);
+ }