Hello guys am designing an app that uses buttons t...
# android
h
Hello guys am designing an app that uses buttons to call different people. but am failing on setting onclicklistener for all the buttons to work. i can set the onclicklistener for only on button but for many i dont know how to do it. am new in kotlin android
stackoverflow 11
n
you can just give id for your buttons in xml and then call every one like that
Copy code
button1.setOnClickListener {
            doSomething()
        }
button2.setOnClickListener {
            doSomething()
        }
p
Or Give ids and use the same onclicklistener and check the id of the view coming into the on click