Back to project page mazer.
The source code is released under:
GNU General Public License
If you think the Android project mazer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.spatialia.santa.util; //from w ww . j a va 2 s . c om import android.os.AsyncTask; public class JobRunner { public static abstract class Job { public void doWork() { } public void doUIBefore() { } public void doUIAfter() { } } public JobRunner() { } public static void run(Job job) { new AsyncServiceTask(job).execute(); } /** * Task used in services. */ private static class AsyncServiceTask extends AsyncTask<Object, Integer, Long> { private Job job; public AsyncServiceTask(Job job) { super(); this.job = job; } @Override protected void onPreExecute() { job.doUIBefore(); } @Override protected Long doInBackground(Object... params) { job.doWork(); return 0L; } @Override protected void onPostExecute(Long result) { job.doUIAfter(); } } }