nifo
nifo

Reputation: 593

Android EditText input and virtual keyboard handling

Is it possible in some way to retrieve the input of an EditText without needing to add a dedicated button underneath (e.g. "SET"), just by touching the "Done" button on the emerging keyboard (Android 2.3.1)?

And if yes, can I somehow handle this event for proceeding to further actions?

Upvotes: 0

Views: 3377

Answers (1)

pankajagarwal
pankajagarwal

Reputation: 13582

try this

editText.setOnEditorActionListener(new OnEditorActionListener() {
    @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId == EditorInfo.IME_ACTION_DONE) {
            // do your stuff here
        }
        return false;
    }
});

As for the second part what do you mean by somehow handle this event for proceeding to further actions?

Upvotes: 3

Related Questions