0

I have a class an activity class as follows:

public class MyActivity extends Activity implements OnTouchListener {}

The whole class is significantly long that have some good depth of views(mainly webview). I am trying to implement a global keyevent logger for this class. I tried to set keylistener for main view but cannot set it because I think I have not extended the OnKeyListener Class? The error I get is

The method is the type view is not applicable for MyActivity

I also have overridden OnKeyDown Method which does not collect any data:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    Log.i("Key Pressed: ", keyCode+" = number");
}

So, what way should I go to grab all keyevent happening inside my activity? I am pretty much clueless at the moment. I really appreciate your help.

EDIT: I am looking for all soft keyboard events only. (Sorry I forgot to mention that...)

Sujit Poudel
  • 541
  • 7
  • 19

1 Answers1

0

ok I see . u want to know which character they typed .
if they type a.b.or c. u want to know that they typed a.b.or c.
when u use SearchVIew .u can set a listener with the character changed.
so I think u can follow this way.

  • u want know the user typed ,so u must receive the user type.
    may be u need something like a EditText.
    see the TextView source code(as EditText extend TextView and EditText and the TextView do the most thing to handle the InputMethodManager)

  • then set a listener about the character changed .

  • this way I think u will know which kind of character will be typed

yftx
  • 110
  • 2
  • 11