如何在每次关闭后重新显示相同的对话框? 我的代码(在科特林):解散后重新显示对话框
val alertDialog = AlertDialog.Builder(this)
alertDialog.setMessage(getString(R.string.alert_dialog_main_activity))
val editText = EditText(this)
editText.inputType = InputType.TYPE_CLASS_PHONE
alertDialog.run {
setView(editText)
setOnDismissListener { TODO("Re-show dialog" }
setPositiveButton("Done", { dialogInterface, i ->
run {
toast(editText.text.toString())
PreferenceManager.getDefaultSharedPreferences(applicationContext).edit().putInt("phoneNumber", editText.text.toString().toInt()).commit()
}
})
show()
}
答案可能是在Java中了。
怎么样不允许解雇,而不是重新打开它?你可以使用show()我打赌 – creativecreatorormaybenot