I use custom dialog but get warning:
Use Nullable Dialog to wrap dialog, to prevent Bad Token etc
TestDialog.kt
class TestDialog(context: Context): Dialog(context) {
private val viewBinding: DialogTestBinding by lazy { DialogTestBinding.inflate(LayoutInflater.from(context)) }
init {
setContentView(viewBinding.root)
window?.setBackgroundDrawable(ColorDrawable(ContextCompat.getColor(context, R.color.theme_dark_less_transparent)))
}
}
I know that I can add @SuppressLint("DialogShow") to prevent warning
but how is the corrent way to prevent from it.