05-18 17:53:35.318: WARN/System.err(474): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
05-18 17:53:35.349: WARN/System.err(474): at android.os.Handler.<init>(Handler.java:121)
05-18 17:53:35.349: WARN/System.err(474): at android.app.Dialog.<init>(Dialog.java:101)
05-18 17:53:35.358: WARN/System.err(474): at android.app.AlertDialog.<init>(AlertDialog.java:63)
05-18 17:53:35.358: WARN/System.err(474): at android.app.ProgressDialog.<init>(ProgressDialog.java:80)
05-18 17:53:35.377: WARN/System.err(474): at android.app.ProgressDialog.<init>(ProgressDialog.java:76)
05-18 17:53:35.377: WARN/System.err(474): at com.Utils.SProgress.StartProgress(SProgress.java:42)
05-18 17:53:35.387: WARN/System.err(474): at com.FindMe.DisplayAtms$Asyctast.onPreExecute(DisplayAtms.java:880)
05-18 17:53:35.400: WARN/System.err(474): at android.os.AsyncTask.execute(AsyncTask.java:391)
05-18 17:53:35.400: WARN/System.err(474): at com.FindMe.DisplayAtms.LoadFunction(DisplayAtms.java:141)
05-18 17:53:35.408: WARN/System.err(474): at com.FindMe.MyApplication$AsyncATMS.doInBackground(MyApplication.java:207)
05-18 17:53:35.419: WARN/System.err(474): at com.FindMe.MyApplication$AsyncATMS.doInBackground(MyApplication.java:1)
05-18 17:53:35.419: WARN/System.err(474): at android.os.AsyncTask$2.call(AsyncTask.java:185)
05-18 17:53:35.427: WARN/System.err(474): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
05-18 17:53:35.438: WARN/System.err(474): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
05-18 17:53:35.438: WARN/System.err(474): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
05-18 17:53:35.447: WARN/System.err(474): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
05-18 17:53:35.458: WARN/System.err(474): at java.lang.Thread.run(Thread.java:1096)
Another function()
{
anotherSingletonprogressdiloag.hide();
.new Asyctast().execute();
}
public class Asyctast extends AsyncTask<Void, Object, Void>
{
private ProgressDialog dialog = new ProgressDialog(DisplayAtms.this);
@Override
protected void onPreExecute() {
super.onPreExecute();
dialog.show();
}
@Override
protected void onProgressUpdate(final Object... args) {
super.onProgressUpdate(args);
if ((Boolean) args[0]) {
Toast.makeText(DisplayAtms.this, args[1].toString(),
Toast.LENGTH_LONG).show();
}
}
@Override
protected Void doInBackground(Void... arg0) {
Log.d("Asynctask", ""+arg0);
publishProgress(true,"sd sdfsdf");
return null;
}
}
我開始放在signleton類另一個對話框後,這個任務被停止線程,然後我試圖啓動另一個進程中的AsyncTask 對話框,本次對話onPreexecute提高尺蠖錯誤任何一個人指導我如何擺脫這個問題?
是的,我得到它我在毛孔上使用runonuiThread(exampleRunable)執行並將該代碼移動到可替代的那個runnable。謝謝 – UMAR 2011-05-18 13:01:20
不要給我投票答案。 – Kakey 2011-05-19 05:26:46