Hi,
I am creating a custom Widget which extends SurfaceView and I am planning to use it for camera preview.
In the main activity I tried to implement some event listeners but can't catch any event.
This is the part of code where I tried to add an event listener:
videoPreview = (CaptureView)findViewById(R.id.capturePreview);
videoPreview.setOnKeyListener(new OnKeyListener(){
public boolean onKey(View v, int keyCode, KeyEvent event){
switch(keyCode)
{
case KeyEvent.KEYCODE_CAMERA:
videoPreview.TakePicture();
return true;
}
return false;
}
});
If I press a button the LogCat outputs "Continuing to wait for key to be dispatched" line.
Does anyone know how to implement event listeners in main activity using SurfaceView classes?
Thanks!