How to deal with keyevents when added a view with WindowManager?
<p>I added a custom view with WindowManager, everything is right.
Just one problem : I cannot find where to catch keyevents such as 'BACK' pressed.
I caught some of the events in method 'View.dispatchKeyEvent()' in my custom view, but not including 'BACK' or 'HOME'.
Any Advice?
Thanks a lot!</p>

<p>My code is just like this:</p>

<pre><code>// get WindowManager

WindowManager windowManager = (WindowManager) getContext()
  .getSystemService(Context.WINDOW_SERVICE);

// set LayoutParams

WindowManager.LayoutParams wmparams = new WindowManager.LayoutParams(
  WindowManager.LayoutParams.WRAP_CONTENT,
  WindowManager.LayoutParams.WRAP_CONTENT);

wmparams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;

wmparams.format = PixelFormat.TRANSLUCENT;

wmparams.windowAnimations = R.style.fade;

// add this view to screen

windowManager.addView(this, wmparams);

this.setOnKeyListener(new OnKeyListener() {

 @Override
 public boolean onKey(View v, int keyCode, KeyEvent event) {
  // cannot get 'BACK' pressed event here
  return false;
 }
});
</code></pre>
