What is this error, and why does it happen?
05-17 18:24:57.069: ERROR/WindowManager(18850): Activity com.mypkg.myP has leaked window com.android.internal.pol
I have another solution for this, and would like to know if it seems valid to you: instead of dismissing in the onDestroy, which seems to be the leading solution, I'm extending ProgressDialog...
public class MyProgressDialog extends ProgressDialog {
private boolean isDismissed;
public MyProgressDialog(Context context) {
super(context);
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
dismiss();
}
@Override
public void dismiss() {
if (isDismissed) {
return;
}
try {
super.dismiss();
} catch (IllegalArgumentException e) {
// ignore
}
isDismissed = true;
}
This is preferable, AFAIC, because you don't have to hold the progress dialog as a member, just fire(show) and forget