Cameraview: Add volume up/down buttons in the Gesture system

Created on 19 Oct 2018  路  4Comments  路  Source: natario1/CameraView

if i want to take picture by volume UP or volume Down button,
so what i do..?

help wanted enhancement

Most helpful comment

Just set a onKeyDown listener and listen 2 KeyEvent.KEYCODE_VOLUME_DOWN or KeyEvent.KEYCODE_VOLUME_UP, then do the TAKEPICTURE action

All 4 comments

Try asking on StackOverflow!

Just set a onKeyDown listener and listen 2 KeyEvent.KEYCODE_VOLUME_DOWN or KeyEvent.KEYCODE_VOLUME_UP, then do the TAKEPICTURE action

I think it would be cool if the library listened to these two and treated them as a Gesture so you can assign GestureActions.

you can override method onKeyDown() in your activity and use it like that

@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP){ // capture image code here ( mCameraView.takePictureSnapshot();) } return super.onKeyDown(keyCode, event);; }

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VGJohn picture VGJohn  路  3Comments

leandro1995 picture leandro1995  路  6Comments

HD-AD picture HD-AD  路  8Comments

uncledoc picture uncledoc  路  3Comments

gabriel-TheCode picture gabriel-TheCode  路  8Comments