android - Customized popup window leads to leaked window. -


i have following code displaying customized popup, executing same leads leaked window error, not able determine how resolve it. following code:

    public void reminder() {     ddialog = new dialog(farrier.this);     ddialog.setcontentview(r.layout.farrierpop2);     ddialog.settitle("reminder");     ddialog.setcancelable(true);     final button pop1 = (button) ddialog.findviewbyid(r.id.btn1);     pop1.setonclicklistener(new onclicklistener() {         public void onclick(view v) {             intent intent = new intent(intent.action_edit);             intent.settype("vnd.android.cursor.item/event");             intent.putextra("title", idb);             intent.putextra("description", "farrier service");             intent.putextra("begintime", "eventstartinmillis");             intent.putextra("endtime", "eventendinmillis");             startactivity(intent);             finish();         }     });     button pop2 = (button) ddialog.findviewbyid(r.id.btn2);     pop2.setonclicklistener(new onclicklistener() {         public void onclick(view v) {             // ddialog.dismiss();             intent ourpartner = new intent(farrier.this, farriersch.class);             startactivity(ourpartner);             finish();         }     });     ddialog.show(); } 

the stack trace is:

*07-01 11:30:18.646: e/windowmanager(407): activity com.gallops.farrier has leaked window com.android.internal.policy.impl.phonewindow$decorview@45fe7468 added here 07-01 11:30:18.646: e/windowmanager(407): android.view.windowleaked: activity com.gallops.farrier has leaked window com.android.internal.policy.impl.phonewindow$decorview@45fe7468 added here 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.viewroot.<init>(viewroot.java:227) 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.windowmanagerimpl.addview(windowmanagerimpl.java:148) 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.windowmanagerimpl.addview(windowmanagerimpl.java:91) 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.window$localwindowmanager.addview(window.java:424) 07-01 11:30:18.646: e/windowmanager(407):   @ android.app.dialog.show(dialog.java:239) 07-01 11:30:18.646: e/windowmanager(407):   @ com.gallops.farrier.reminder(farrier.java:185) 07-01 11:30:18.646: e/windowmanager(407):   @ com.gallops.farrier$2.onclick(farrier.java:915) 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.view.performclick(view.java:2364) 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.view.ontouchevent(view.java:4179) 07-01 11:30:18.646: e/windowmanager(407):   @ android.widget.textview.ontouchevent(textview.java:6541) 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.view.dispatchtouchevent(view.java:3709) 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 07-01 11:30:18.646: e/windowmanager(407):   @ com.android.internal.policy.impl.phonewindow$decorview.superdispatchtouchevent(phonewindow.java:1659) 07-01 11:30:18.646: e/windowmanager(407):   @ com.android.internal.policy.impl.phonewindow.superdispatchtouchevent(phonewindow.java:1107) 07-01 11:30:18.646: e/windowmanager(407):   @ android.app.activity.dispatchtouchevent(activity.java:2061) 07-01 11:30:18.646: e/windowmanager(407):   @ com.android.internal.policy.impl.phonewindow$decorview.dispatchtouchevent(phonewindow.java:1643) 07-01 11:30:18.646: e/windowmanager(407):   @ android.view.viewroot.handlemessage(viewroot.java:1691) 07-01 11:30:18.646: e/windowmanager(407):   @ android.os.handler.dispatchmessage(handler.java:99) 07-01 11:30:18.646: e/windowmanager(407):   @ android.os.looper.loop(looper.java:123) 07-01 11:30:18.646: e/windowmanager(407):   @ android.app.activitythread.main(activitythread.java:4363) 07-01 11:30:18.646: e/windowmanager(407):   @ java.lang.reflect.method.invokenative(native method) 07-01 11:30:18.646: e/windowmanager(407):   @ java.lang.reflect.method.invoke(method.java:521) 07-01 11:30:18.646: e/windowmanager(407):   @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:860) 07-01 11:30:18.646: e/windowmanager(407):   @ com.android.internal.os.zygoteinit.main(zygoteinit.java:618) 07-01 11:30:18.646: e/windowmanager(407):   @ dalvik.system.nativestart.main(native method)* 

you finishing parent activity of dialog have dismiss dialog first , have set oncanclelistener dialog , in oncanclelistener start other activity , finish activity

ddialog.setoncanclelistener();  @override oncancle() { startactivityone();  or  startactivitytwo(); }  public void reminder() { ddialog = new dialog(farrier.this); ddialog.setcontentview(r.layout.farrierpop2); ddialog.settitle("reminder"); ddialog.setcancelable(true); final button pop1 = (button) ddialog.findviewbyid(r.id.btn1); pop1.setonclicklistener(new onclicklistener() {     public void onclick(view v) {         intent intent = new intent(intent.action_edit);         intent.settype("vnd.android.cursor.item/event");         intent.putextra("title", idb);         intent.putextra("description", "farrier service");         intent.putextra("begintime", "eventstartinmillis");         intent.putextra("endtime", "eventendinmillis");         startactivity(intent);         finish();     } }); button pop2 = (button) ddialog.findviewbyid(r.id.btn2); pop2.setonclicklistener(new onclicklistener() {     public void onclick(view v) {         // ddialog.dismiss();         intent ourpartner = new intent(farrier.this, farriersch.class);         startactivity(ourpartner);         finish();     } }); ddialog.show(); } 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -