I have a user input box that I want to execute a function every time I
press enter.  I can't call super.onKey(...) to do the standard text
input.

I have two ways to solve this problems, but I'm having trouble looking
for places to find out how to do this.
1. Convert the keycode to a character that I can append to (theText)
2. Find a standard onKeyListener that I can call

---------------------------------------------------------------------------------------------------------------------------
final EditText userInputBox = (EditText) findViewById
(R.id.editTextItems);
        userInputBox.setOnKeyListener(new OnKeyListener()
        {
                public boolean onKey(View v, int keyCode, KeyEvent event)
                {
                    // code
                        Editable theText = userInputBox.getText();
                        int pressedKey = event.getUnicodeChar();
                        if (pressedKey == '\n')
                        {
                                addUserInput();
                        }

                        return true;
                }
        });
---------------------------------------------------------------------------------------------------------------------------

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to