Thank you for responding Ben. 

I've also added an "Enter" key button next to the text view, and may go the 
route you describe. Right now, I'm still trying to hunt down the root cause 
if I can. I mean, it's an edit text for crying out loud! This should be 
simple....

For a while I thought that perhaps setting the text, as you show above 
(v.setText("");) while in the onKeyListener had something to do with it, but 
I've trimmed down my listener to the following:

EditText.OnKeyListener mOnCommandKeyListener = new EditText.OnKeyListener() 
{
public boolean onKey(View view, int keyCode, KeyEvent event) {
boolean result = false;

if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (keyCode) {
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_DPAD_CENTER:

mHandler.sendEmptyMessage(MSG_TEXT_COMMAND);

result = true;
break;
}
}
// TODO: Debugging
Utilities.errorLog("onCommandKey: KeyCode - "
+ Utilities.translateKeyCode(keyCode, event));

return result;
}
};

As you can see, there just isn't a lot to it and I've managed to omit any 
changes to the EditText from within it. But to no avail.

I've finally captured a log of this happening. For the sake of trying to 
track this down, I've added a TextWatcher to do some logging (don't need it 
otherwise for the app).

Here, the log shows me entering the letter "o". This displayed in the 
EditText

06-06 18:30:40.339: ERROR/com.myproject.myactivity(772): TextWatcher: o
06-06 18:30:41.199: ERROR/com.myproject.myactivity(772): onCommandKey: 
KeyCode - KEYCODE_ENTER
06-06 18:30:41.209: ERROR/com.myproject.myactivity(772): TextWatcher: 
06-06 18:30:41.249: ERROR/com.myproject.myactivity(772): onCommandKey: 
KeyCode - KEYCODE_ENTER
06-06 18:30:41.249: DEBUG/dalvikvm(772): GC_CONCURRENT freed 381K, 9% free 
7204K/7879K, paused 3ms+3ms

Then, this happened. Whatever has caused this error seems to be at the root 
of this issue. I've noticed it in the logs before when I've been trying to 
track this down. This is the first set of logs I have that shows the key 
entered, and the issue. There is no discernible change to the screen when 
this happens other than the edit text forgetting to print the characters 
typed.

06-06 18:30:41.249: WARN/IInputConnectionWrapper(772): endBatchEdit on 
inactive InputConnection

06-06 18:30:41.279: DEBUG/Tablet/NotificationPanel(185): notificationCount=1
06-06 18:30:41.779: DEBUG/Tablet/NotificationPanel(185): notificationCount=1

Here, the letter "p" did not show up in the EditText, but it did get saved 
with the EditText in that getText, etc. could see it as is evidenced by the 
TextWatcher output.

06-06 18:30:42.219: ERROR/com.myproject.myactivity(772): TextWatcher: p

Now I need to research the endBatchEdit.

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

Reply via email to