I am working with Android application to show network error.
NetErrorPage.java
package exp.app;
import android.app.Activity;
impor
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 Dialogs and other dynamically created Views, 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.