android activity has leaked window com.android.internal.policy.impl.phonewindow$decorview Issue
Thank you Guys to give me many suggestions. Finally I got a solution. That is i have started the NetErrorPage intent two times. One time, i have checked the net connection availability and started the intent in page started event. second time, if the page has error, then i have started the intent in OnReceivedError event. So the first time dialog is not closed, before that the second dialog is called. So that i got a error.
Reason for the Error: I have called the showInfoMessageDialog method two times before closing the first one.
Now I have removed the second call and Cleared error :-).
Change this dialog.cancel();
to dialog.dismiss();
The solution is to call dismiss()
on the Dialog
you created in NetErrorPage.java:114 before exiting the Activity
, e.g. in onPause()
.
Views have a reference to their parent Context
(taken from constructor argument). If you leave an Activity
without destroying Dialog
s and other dynamically created View
s, they still hold this reference to your Activity
(if you created with this as Context
: like new ProgressDialog(this)
), so it cannot be collected by the GC, causing a memory leak.
In my case finish()
executed immediately after a dialog has shown.