Here is my code, and there is no problem in XML all the ids of the views are correct
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val button: Button = findViewById(R.id.button)
val stringInTextField:EditText = findViewById(R.id.bill)
button.setOnClickListener(View.OnClickListener{
val userInput = stringInTextField.text.toString()
if (userInput.isEmpty) {
Toast.makeText(this, "Please Enter the Bill", Toast.LENGTH_SHORT).show()
}
})
}