Hi all,
I write simple code to handle user clicks, but sometimes use clicks on the button and no log message print in logcat and no toast on screen.
Here is the simple code:
class MainActivity : AppCompatActivity() {
companion object {
const val LOG_TAG = "MAIN-ACTIVITY"
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
bt_test.setOnClickListener {
Log.d(LOG_TAG, "Scan button clicked.")
Toast.makeText(this, "hey hey", Toast.LENGTH_SHORT).show()
}
}
}