All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.graphhopper.android.GHAsyncTask Maven / Gradle / Ivy

There is a newer version: 0.11.0
Show newest version
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