android - Why is our dismiss call causing an AndroidRuntimeException? -
in our code, have simple method dismiss dialog, inside our implementation of dialogfragment
:
public class ourdialogfragment extends ourbasicdialogfragment { // <= line 15 // ... protected onclicklistener _btnpositiveonclicklistenerwithclose = new onclicklistener() { @override public void onclick(view v) { if (_btnpositivelistener != null) { _btnpositivelistener.onclick(ourdialogfragment.this, dialoginterface.button_positive); } dismissdialog(); // <= line 30 } }; // ... private void dismissdialog() { if (ourdialogfragment.this.getdialog() != null) { simplealertdialog.this.dismiss(); // <= line 58 } else if (getoverridedialog() != null) { getoverridedialog().dismiss(); setoverridedialog(null); } } // ... }
this method called when our dialog's ok
button pressed. however, on specified line 58, this:
06-04 11:39:59.160 32694-32694/com.ourapp.app e/mainactivity﹕ uncaughtexceptionhandler android.util.androidruntimeexception: { what=3 when=-4s47ms } message in use. @ android.os.messagequeue.enqueuemessage(messagequeue.java:285) @ android.os.handler.enqueuemessage(handler.java:618) @ android.os.handler.sendmessageattime(handler.java:587) @ android.os.handler.sendmessagedelayed(handler.java:558) @ android.os.handler.sendemptymessagedelayed(handler.java:522) @ android.os.handler.sendemptymessage(handler.java:507) @ android.view.viewrootimpl.die(viewrootimpl.java:4079) @ android.view.windowmanagerglobal.removeviewlocked(windowmanagerglobal.java:336) @ android.view.windowmanagerglobal.removeview(windowmanagerglobal.java:286) @ android.view.windowmanagerimpl.removeview(windowmanagerimpl.java:79) @ android.app.dialog.dismissdialog(dialog.java:323) @ android.app.dialog.dismiss(dialog.java:306) @ android.app.dialogfragment.dismissinternal(dialogfragment.java:278) @ android.app.dialogfragment.dismiss(dialogfragment.java:258) @ com.ourapp.ui.ourdialogfragment.dismissdialog(ourdialogfragment.java:58) @ com.ourapp.ui.ourdialogfragment.access$000(ourdialogfragment.java:15) @ com.ourapp.ui.ourdialogfragment$1.onclick(ourdialogfragment.java:30) @ android.view.view.performclick(view.java:4204) @ android.view.view$performclick.run(view.java:17355) @ android.os.handler.handlecallback(handler.java:725) @ android.os.handler.dispatchmessage(handler.java:92) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5041) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:560) @ dalvik.system.nativestart.main(native method)
we wrote (and have access to) code in com.ourapp.ui.ourdialogfragment
parts of trace.
since don't create messages, less try use them, why error occur?
we solved adding following our message handler class, not obvious because it's not referenced in stack trace:
@override public void handlemessage(message msg) { this.obtainmessage(); // rest of method }
Comments
Post a Comment