Balkrishna Rawool Balkrishna Rawool - 1 year ago 134
Android Question

How to capture onclick event in disabled EditText in Android App

I have a EditText which I am presenting as disabled so that user cannot edit the contents and also to avoid popping-up keyboard. But now I want to capture onclick event in the EditText and identify the individual words that are being clicked.
Any help is most welcome.


Answer Source

On your EditText set attributes android:focusable="false" and android:enabled="true". And set OnClickListener to that EditText. The click on that Edittext triggers the onClick() method but it can't be edited. I just tried it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download