我在“警报”对话框中收到以上错误,但不确定为什么或如何解决。 我相信它来自以下功能。 基本上,在我的应用程序中,导航到详细信息片段,然后在应用程序中单击发送按钮以共享应用程序崩溃的SMS。 请看一下我的代码。任何帮助表示赞赏。
if (sendSmsStarted && permissionGranted) {
context?.let {
val smsInfo = SmsInfo(
"",
"${currentDog?.dogBreed} bred for ${currentDog?.bredFor}",
currentDog?.imageUrl
)
val diaologBinding: SendSmsDiaologBinding =
DataBindingUtil.inflate<SendSmsDiaologBinding>(
LayoutInflater.from(it),
R.layout.send_sms_diaolog, null, false
)
androidx.appcompat.app.AlertDialog.Builder(it).setView(databinding.root)
.setPositiveButton("Send SMS") { dialog: DialogInterface, which ->
if (!diaologBinding.smsInfo.toString().isNullOrEmpty()) {
smsInfo.to = diaologBinding.smsInfo.toString()
sendSms(smsInfo)
}
}
.setNegativeButton("Cancel") { dialog: DialogInterface, which -> }
.show()
diaologBinding.smsInfo = smsInfo
}
}
}```
答案 0 :(得分:0)
我相信您打算将刚膨胀的diaologBinding.root
而不是databinding.root
用作对话框视图。后者看起来就像您已经用于其他用途的东西。