ProgressDialog : how to prevent Leaked Window?

The leak comes probably from your PixelRainActivity. StaticThis attribute. If you’re keeping a reference to an activity, even after that this activity has been destroyed, you have a memory leak The easiest way to fix is to use the application’s Context instead.

Change your staticThis = this line in the method onCreate() to staticThis = this. GetApplicationContext() and it should work (and change the type of staticThis to Context if this is not already the case).

The leak comes probably from your PixelRainActivity. StaticThis attribute. If you’re keeping a reference to an activity, even after that this activity has been destroyed, you have a memory leak.

The easiest way to fix is to use the application’s Context instead. Change your staticThis = this line in the method onCreate() to staticThis = this. GetApplicationContext() and it should work (and change the type of staticThis to Context if this is not already the case).

Instead of using ProgressDialog.show(), try using Activity.showDialog() which should automatically manage the dialog for you and prevent leaks. EDIT: When you call showDialog(int), it will trigger Activity. OnCreateDialog(int) where you can create the Dialog you want and return the Dialog you want to display.

I ran into a similar problem with a progress dialog and a background task. The AsyncTask (developer.android.com/resources/articles...) allowed me to do both much more cleanly and without the leaked window.

"07-06 17:10:50.363: ERROR/WindowManager(8821): Activity android.pixelrain.framework. PixelRainActivity has leaked window com.android.internal.policy.impl. 07-06 17:10:50.363: ERROR/WindowManager(8821): android.view.

WindowLeaked: Activity android.pixelrain.framework. PixelRainActivity has leaked window com.android.internal.policy.impl. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.view.ViewRoot.

07-06 17:10:50.363: ERROR/WindowManager(8821): at android.view. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.view. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.view.

07-06 17:10:50.363: ERROR/WindowManager(8821): at android.app.Dialog. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.app.ProgressDialog. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.app.ProgressDialog.

07-06 17:10:50.363: ERROR/WindowManager(8821): at android.pixelrain.HTTPHelper.DraftHelper. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.pixelrain.online.OnlineRetriver. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.pixelrain.HTTPHelper.DraftButtonGL.

07-06 17:10:50.363: ERROR/WindowManager(8821): at android.pixelrain.HTTPHelper.DraftButtonGL. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.pixelrain.opengl.views.game.QuickStartGL. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.pixelrain.game.GameHandler.

07-06 17:10:50.363: ERROR/WindowManager(8821): at android.pixelrain.opengl. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.view.View. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.view.ViewGroup.

07-06 17:10:50.363: ERROR/WindowManager(8821): at android.view.ViewGroup. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.view.ViewGroup. 07-06 17:10:50.363: ERROR/WindowManager(8821): at com.android.internal.policy.impl.

07-06 17:10:50.363: ERROR/WindowManager(8821): at com.android.internal.policy.impl.PhoneWindow. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.app.Activity. 07-06 17:10:50.363: ERROR/WindowManager(8821): at com.android.internal.policy.impl.

07-06 17:10:50.363: ERROR/WindowManager(8821): at android.view.ViewRoot. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.os.Handler. 07-06 17:10:50.363: ERROR/WindowManager(8821): at android.os.Looper.

07-06 17:10:50.363: ERROR/WindowManager(8821): at android.app.ActivityThread. 07-06 17:10:50.363: ERROR/WindowManager(8821): at java.lang.reflect.Method. 07-06 17:10:50.363: ERROR/WindowManager(8821): at java.lang.reflect.Method.

07-06 17:10:50.363: ERROR/WindowManager(8821): at com.android.internal.os. 07-06 17:10:50.363: ERROR/WindowManager(8821): at com.android.internal.os.ZygoteInit. 07-06 17:10:50.363: ERROR/WindowManager(8821): at dalvik.system.NativeStart.

ProgressDialog = ProgressDialog. ProgressDialog = ProgressDialog.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions