Skip to content

Instantly share code, notes, and snippets.

@yogacp
Created August 12, 2019 16:43
Show Gist options
  • Save yogacp/8196aabdbfe898ddcc09e083a518f41a to your computer and use it in GitHub Desktop.
Save yogacp/8196aabdbfe898ddcc09e083a518f41a to your computer and use it in GitHub Desktop.
interface OnClickListener {
fun onClick(v: View)
fun onLongClick(v: View)
fun onTouch(v: View, event: MotionEvent)
}
val button = findViewById<Button>(R.id.button)
button.setOnClickListener(object: OnClickListener{
override fun onClick(v: View) {
// Want to do some magic here
}
override fun onLongClick(v: View) {
// No need this function
}
override fun onTouch(v: View, event: MotionEvent) {
// No need this function
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment