To assign a click listener to view, need to write

If you write without describing generic as View
you will recieve error message

Type inference failed: Not enough information to infer parameter T in 

fun <T : View!> findViewById(id: Int): T!
Please specify it explicitly.

But you need method setOnClickListener in View class. So it easy to parse T:View! as View

Discussed here: