How to identify widget and how implement Listener in Kotlin?

279 views.

How to identify widget and how implement Listener in Kotlin

Add Comment
1 Answer(s)
135 views.

//for example Identify Button like this

val  button=findViewById (R.id.button) as Button
 

//for clicklistner

button.setOnClickListner{
 
//Write your code here
 
}
  

//To get view of Widget in listner

button.setOnClickListner(object : View.setOnClickListner {
 
object.id  //to get id of button
 
//your action code here
 
})
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.