com.graphhopper.android.GHAsyncTask Maven / Gradle / Ivy
package com.graphhopper.android;
import android.os.AsyncTask;
public abstract class GHAsyncTask extends AsyncTask {
private Throwable error;
protected abstract C saveDoInBackground(A... params) throws Exception;
protected C doInBackground(A... params) {
try {
return saveDoInBackground(params);
} catch (Throwable t) {
error = t;
return null;
}
}
public boolean hasError() {
return error != null;
}
public Throwable getError() {
return error;
}
public String getErrorMessage() {
if (hasError()) {
return error.getMessage();
}
return "No Error";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy