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. HTC Legend-Red edition

as subject mau jual HTC legend red edition, second baru 2 minggu pake,
Prefer COD sekitaran SCBD dan senopati sekitar jam 6an sore...


Japri yah, gambar akan menyusul ya

08111996122

-- 
using my finger for typing...

-- 
"Indonesian Android Community [id-android]" 

2. Textview Editable - Virtual Keyboard Error

Hi,

I set my textview as editable.
when i try to type in virtual keyboard it throws an error & force close the
application.
Error = ' java.lang.IndexOutOfBoundsException: getChars (-1 ... 0) starts
before 0 '
Its work in pc keyboard.
Any suggestion ?.

-- 

3. Any way to set up a 2.1+ emulator without live wallpapers?

4. Why my application doesn't in application history?

5. Not BroadcastReciver on uninstall application

6. Video: iPhone 4, iOS 4, and iBooks on iPhone

7. Design Kaos Androi