execute api requests on a thread pool
This commit is contained in:
parent
327f1af0ba
commit
e3575f6be8
@ -17,6 +17,7 @@ import javax.net.ssl.SSLSession;
|
|||||||
import javax.net.ssl.TrustManager;
|
import javax.net.ssl.TrustManager;
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
@ -64,6 +65,15 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonE
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NewApi")
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void execute(HashMap<String,String> map) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
super.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, map);
|
||||||
|
else
|
||||||
|
super.execute(map);
|
||||||
|
}
|
||||||
|
|
||||||
protected int getErrorMessage() {
|
protected int getErrorMessage() {
|
||||||
switch (m_lastError) {
|
switch (m_lastError) {
|
||||||
case NO_ERROR:
|
case NO_ERROR:
|
||||||
|
Loading…
Reference in New Issue
Block a user