使用handler连续显示两个dialog会崩溃,没定位到问题,麻烦有时间看下,感谢。
summertravel opened this issue · comments
Attempt to invoke virtual method 'void android.app.Dialog.setOnKeyListener(android.content.DialogInterface$OnKeyListener)' on a null object reference
以下是测试代码:
handler.post {
meetDialog?.doDismiss()
meetDialog = MessageDialog.build(ActivityUtils.topActivity as AppCompatActivity)
.setTitle("test")
.setMessage(null)
.setCancelable(false)
.setOkButton(getString(R.string.ok)) { _, _ ->
false
}
meetDialog?.show()
}
handler.post {
meetDialog?.doDismiss()
meetDialog = MessageDialog.build(ActivityUtils.topActivity as AppCompatActivity)
.setTitle("test1")
.setMessage(null)
.setCancelable(false)
.setOkButton(getString(R.string.ok)) { _, _ ->
false
}
meetDialog?.show()
}