Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to use keyboard Done/Enter to perform action

You can use this one also (sets a special listener to be called when an action is Performed on the EditText), it works both for DONE and ENTER:




max.setOnEditorActionListener(new OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
Log.i(TAG, "Enter pressed");
}
return false;
}
});


TextView.OnEditorActionListener
Interface definition for a callback to be invoked when an action is performed on the editor.


This post first appeared on Java4you - Java Programming Tutorials, Examples,, please read the originial post: here

Share the post

How to use keyboard Done/Enter to perform action

×

Subscribe to Java4you - Java Programming Tutorials, Examples,

Get updates delivered right to your inbox!

Thank you for your subscription

×