KeyListener not working as expected

by MB » Wed, 14 Apr 2010 03:03:50 GMT


Sponsored Links
 Hello All,
I am trying to implement a basic program.

I have a EditText view, and want to set a KeyListener to it.

Here is the code below.

myText.setOnKeyListener(new View.OnKeyListener() {
           public boolean onKey(View view,int keyCode,KeyEvent ke)
{
                        Log.d(TAG,nto on key;
               return true;
            }
});

As it is returning true, the onKey method is called for all keys from
keyboard on screen, but the typed text does not appear on the EditText
view.

If I return false, the onKey method is called for only meta keys like
Backspace (keyboard on screen),and the typed text does appear on the
EditText view.

I want to typed text on the EditText view, and work for all keys from
keyboard on screen(default Qwerty keyboard).

Where am I making mistake.

Could anyone pls let me know.

Thanks,
MB

--



Other Threads

1. RemoteViews setSelected

Hi,

I am trying to do aRemoteViews.setBoolean(R.id.a_text_view,
"setSelected", true) on a text view in a homescreen widget to select
the view, but I only get the textview to display a text like "error
expanding view"(!). The log says:
android.widget.RemoteViews$ActionException: view:
android.widget.TextView can't use method with RemoteViews: setSelected
(boolean).

Ok, so I cannot use setSelected (through reflection) on the remote
text view(?). But I would still like to set it to selected to get the
maquee-scrolling going again (which worked with the initial view,
before the update of the text).

Any ideas?
Thanks!

/Michael

-- 

2. Sports & Actress

Sachin Tendulkar cracks 45th Test hundred - Top Stories - India in ...
Asin| Actress Asin| Tamil Actress Asin Latest Pictures | Hot Asin ...
More info : http://123maza.com/50/rashers/

-- 

3. Paging Medan Androidan..

4. How to send data along a phone call

5. alsa_aplay error

6. Listeners

7. My new Nexus One: FedEx delayed - Oklahoma ice storm