How can I implement a TextWatcher on an Activity
Implementing a TextWatcher
on an Editable like EditText
is quite simple. However, I want to listen for key input without a specific Editable in focus so that the user can launch the activity
, without clicking on an EditText
or any开发者_如何学Gothing. So you can just start typing (hard keyboard) or hold the menu soft key until the soft keyboard comes up and then I want to register these key events.
I have tried having my Activity
implement TextWatcher
, however the callbacks like onTextChanged()
never get called. Has anyone ever done this before?
I think at that point you want to switch to Activity.onKeyDown() and related.
精彩评论