我需要在扩展 AsyncTask 中显示 ProgressDialog ...但是...
public class TareaAsincrona extends AsyncTask<Void, Void, Void> {
protected void onPreExecute()
{
pdialog = new ProgressDialog(Principal.this);
pdialog.setMessage("Wolas");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
pdialog.show();
}
protected void onPostExecute()
{ pdialog.dismiss(); }
protected Void doInBackground(Void... params) { .... .... } //// //// }
}
日志猫
04-19 14:59:40.844: E/dalvikvm(21264): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
04-19 14:59:41.434: E/WindowManager(21264): Activity dsm.transporte_ordtra.Principal has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4165d0a0 that was originally added here
04-19 14:59:41.434: E/WindowManager(21264): android.view.WindowLeaked: Activity dsm.transporte_ordtra.Principal has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4165d0a0 that was originally added here
04-19 14:59:41.434: E/WindowManager(21264): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:344)
04-19 14:59:41.434: E/WindowManager(21264): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:267)
04-19 14:59:41.434: E/WindowManager(21264): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
04-19 14:59:41.434: E/WindowManager(21264): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)
04-19 14:59:41.434: E/WindowManager(21264): at android.view.Window$LocalWindowManager.addView(Window.java:537)
04-19 14:59:41.434: E/WindowManager(21264): at android.app.Dialog.show(Dialog.java:278)
04-19 14:59:41.434: E/WindowManager(21264): at dsm.transporte_ordtra.Principal$TareaAsincrona.onPreExecute(Principal.java:211)
04-19 14:59:41.434: E/WindowManager(21264): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:561)
04-19 14:59:41.434: E/WindowManager(21264): at android.os.AsyncTask.execute(AsyncTask.java:511)
04-19 14:59:41.434: E/WindowManager(21264): at dsm.transporte_ordtra.Principal$3.onClick(Principal.java:145)
04-19 14:59:41.434: E/WindowManager(21264): at android.view.View.performClick(View.java:3511)
04-19 14:59:41.434: E/WindowManager(21264): at android.view.View$PerformClick.run(View.java:14105)
04-19 14:59:41.434: E/WindowManager(21264): at android.os.Handler.handleCallback(Handler.java:605)
04-19 14:59:41.434: E/WindowManager(21264): at android.os.Handler.dispatchMessage(Handler.java:92)
04-19 14:59:41.434: E/WindowManager(21264): at android.os.Looper.loop(Looper.java:137)
04-19 14:59:41.434: E/WindowManager(21264): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-19 14:59:41.434: E/WindowManager(21264): at java.lang.reflect.Method.invokeNative(Native Method)
04-19 14:59:41.434: E/WindowManager(21264): at java.lang.reflect.Method.invoke(Method.java:511)
04-19 14:59:41.434: E/WindowManager(21264): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-19 14:59:41.434: E/WindowManager(21264): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-19 14:59:41.434: E/WindowManager(21264): at dalvik.system.NativeStart.main(Native Method)