Address potential performance issue

This commit is contained in:
Martin Fietz 2016-04-22 14:29:32 +02:00
parent 69fad87166
commit 08760618d1
2 changed files with 12 additions and 3 deletions

View File

@ -239,7 +239,11 @@ public class FeedInfoActivity extends ActionBarActivity {
} }
} }
}; };
loadTask.execute(feedId); if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
loadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, feedId);
} else {
loadTask.execute(feedId);
}
} }

View File

@ -121,7 +121,7 @@ public class GpodnetAuthenticationActivity extends ActionBarActivity {
final String passwordStr = password.getText().toString(); final String passwordStr = password.getText().toString();
if (BuildConfig.DEBUG) Log.d(TAG, "Checking login credentials"); if (BuildConfig.DEBUG) Log.d(TAG, "Checking login credentials");
new AsyncTask<GpodnetService, Void, Void>() { AsyncTask<GpodnetService, Void, Void> authTask = new AsyncTask<GpodnetService, Void, Void>() {
volatile Exception exception; volatile Exception exception;
@ -160,7 +160,12 @@ public class GpodnetAuthenticationActivity extends ActionBarActivity {
} }
return null; return null;
} }
}.execute(service); };
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
authTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, service);
} else {
authTask.execute();
}
} }
}); });
} }