Android: onKeyDown() problem
Posted
by niko
on Stack Overflow
See other posts from Stack Overflow
or by niko
Published on 2009-06-10T10:02:40Z
Indexed on
2010/03/23
12:33 UTC
Read the original article
Hit count: 1175
Hi,
I would like to create a photo/video capture application.
I have created a CaptureView class which extends SurfaceView and placed it in the main form.
The main form's activity has onCreateOptionsMenu() method which creates a menu. The menu worked fine but then I tried to implement a method onKeyDown:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(event.getAction() == KeyEvent.ACTION_DOWN)
{
switch(keyCode)
{
case KeyEvent.KEYCODE_CAMERA:
videoPreview.TakePicture();
return true;
}
}
return super.onKeyDown(keyCode, event);
}
The menu doesn't appear anymore and the method doesn't catch onKeyDown event.
Does anyone know what could be the reason for this issue?
Thanks!
© Stack Overflow or respective owner