android.os.AsyncTask Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of remote-pay-java-connector Show documentation
Show all versions of remote-pay-java-connector Show documentation
Clover Connector Java library
package android.os;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public abstract class AsyncTask {
public void execute(final Params... args) {
final ExecutorService executor = Executors.newSingleThreadExecutor();
executor.execute(new Runnable() {
@Override public void run() {
onPreExecute();
executor.execute(new Runnable(){
@Override public void run() {
final Result result = doInBackground(args);
executor.execute(new Runnable() {
@Override public void run() {
onPostExecute(result);
executor.shutdown();
}
});
}
});
}
});
}
protected void onPreExecute(){}
protected abstract Result doInBackground(Params... params);
protected void onPostExecute(Result result){}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy