Android : Why onClick method is not working?

Add one more attribute to the textview in xml:

android:clickable="true"


Buttons are by default clickable but TextViews are not. Unless you explicitly setup the onClick listener at runtime textViews won't be clickable on pre-Lollipop devices.

So if you want to make a TextView clickable which is hooked with a listener in XML layout file you should use

android:clickable="true"

Dont forget to remove the on click listener (if you have set that programmatically inside the containing activity).