Disabling the keyboard's send button when nothing has been typed yet [Android]

Pieter888 picture Pieter888 · May 7, 2012 · Viewed 8.4k times · Source

I'm creating a search option in an android application.

After pressing "Search" on the screen-keyboard an event triggers which sends the query to the server. What I want to do is disable the "Search" button on the screen-keyboard when no text has been typed in it's corresponding EditText yet.

I added this to the EditText:

android:imeOptions="actionSearch"

So that's why the keyboard has got a "Search" button in stead of the default "enter"/"done". (Just in case you where wondering).

Answer

Ronnie picture Ronnie · May 12, 2012

We cannot disable the action button on the android keyboard. You will have to settle with checking for empty string in editor action listener.