org.usergrid.android.client.callbacks.ClientAsyncTask Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of usergrid-android-client Show documentation
Show all versions of usergrid-android-client Show documentation
A simple java client for usergrid
package org.usergrid.android.client.callbacks;
import android.os.AsyncTask;
public abstract class ClientAsyncTask extends AsyncTask {
ClientCallback callback;
public ClientAsyncTask(ClientCallback callback) {
this.callback = callback;
}
@Override
protected T doInBackground(Void... v) {
try {
return doTask();
} catch (Exception e) {
this.publishProgress(e);
}
return null;
}
public abstract T doTask();
@Override
protected void onPostExecute(T response) {
if (callback != null) {
callback.onResponse(response);
}
}
@Override
protected void onProgressUpdate(Exception... e) {
if ((callback != null) && (e != null) && (e.length > 0)) {
callback.onException(e[0]);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy