Hi experts,
I have implemented an Instrumentation object. I want to simulate BACK
key event after typing text on an EditText to close the virtual
keyboard. The main problem is that, I can't simulate or inject BACK
event while virtual keyboard is showing on screen in LANDSCAPE mode.
If I use these lines of code:
instrumentation.sendKeyDownUpSync(KEYCODE_BACK);
then i get the security exception: "Injecting to another application
requires INJECT_EVENTS permission". This exception means that I can't
inject BACK event to keyboard view, right?
If I use these lines of code:
m_activity.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,
KEYCODE_BACK));
m_activity.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,
KEYCODE_BACK));
then the current Activity will disappear. This is an unexpected case.
I don't want to kill my Activity, just close the keyboard.
How can I do if I want to close the virtual keyboard only? How can I
detect the virtual keyboard is current in full screen mode?
(InputMethodManager::isFullscreenMode() doesnot work in this case).
Thank you very much.
--
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