Dismiss android preferences dialog on Keyboard ACTION_DONE press

Posted by Damian on Stack Overflow See other posts from Stack Overflow or by Damian
Published on 2010-03-15T23:13:49Z Indexed on 2010/03/16 0:29 UTC
Read the original article Hit count: 1049

Filed under:
|
|

I would like to be able to close the editpreference dialog (as shown here http://twitpic.com/18ttdp) by pressing the 'Done' button on the keyboard.

Currently, pressing 'Done' just dismisses the keyboard but leaves the dialog.

In other parts of my application I use code similar to the following to intercept the 'Done' key press and execute actions in my activity:

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

However, I am unsure of how to do achieve this same effect in my preference activity or layout xml.

© Stack Overflow or respective owner

Related posts about android

Related posts about preferences