Skip to content

Commit 28a27ff

Browse files
committed
Add asyncPost for Runnable.
1 parent 578eb9d commit 28a27ff

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

src/com/androidquery/util/AQUtility.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import android.app.Application;
4040
import android.content.Context;
4141
import android.content.SharedPreferences.Editor;
42+
import android.os.AsyncTask;
4243
import android.os.Environment;
4344
import android.os.Handler;
4445
import android.os.Looper;
@@ -293,16 +294,50 @@ public void run() {
293294
});
294295
}
295296

297+
public static void postAsync(final Runnable run){
298+
299+
AsyncTask<Void, Void, String> task = new AsyncTask<Void, Void, String>(){
300+
301+
@Override
302+
protected String doInBackground(Void... params) {
303+
304+
try{
305+
run.run();
306+
}catch(Exception e){
307+
AQUtility.report(e);
308+
}
309+
310+
311+
return null;
312+
}
313+
314+
};
315+
316+
task.execute();
317+
318+
}
319+
320+
296321
public static void postAsync(Object handler, String method){
297322
postAsync(handler, method, new Class[0]);
298323
}
299324

300325
public static void postAsync(final Object handler, final String method, final Class<?>[] sig, final Object... params){
301-
326+
/*
302327
ExecutorService exe = getFileStoreExecutor();
303328
304329
exe.execute(new Runnable() {
305330
331+
@Override
332+
public void run() {
333+
334+
AQUtility.invokeHandler(handler, method, false, true, sig, params);
335+
336+
}
337+
});
338+
*/
339+
postAsync(new Runnable() {
340+
306341
@Override
307342
public void run() {
308343

0 commit comments

Comments
 (0)