Zoom Control in Camera is not working in Android -
i working on custom camera using surface view in application, recording video screen capture.
i looking implement zoom control in camera code not getting success.
getting log while zooming:
e/adreno200-es20(12756): <qgl2drvapi_glbuffersubdata:709>: gl_invalid_operation
i using below code:
/** * setzoomcontrol * @param params */
public void setzoomcontrol(camera.parameters params) { paramtrs = params; zoomcontrols zoomcontrols = (zoomcontrols) findviewbyid(r.id.zoomcontrols); if (params.iszoomsupported()) { final int maxzoomlevel = paramtrs.getmaxzoom(); log.i("max zoom ", "is " + maxzoomlevel); zoomcontrols.setiszoominenabled(true); zoomcontrols.setiszoomoutenabled(true); zoomcontrols.setonzoominclicklistener(new onclicklistener() { public void onclick(view v) { int currentzoomlevel = 0; if (currentzoomlevel < maxzoomlevel) { currentzoomlevel++; camera.startsmoothzoom(currentzoomlevel); } } }); zoomcontrols.setonzoomoutclicklistener(new onclicklistener() { public void onclick(view v) { int currentzoomlevel = 0; if (currentzoomlevel > 0) { currentzoomlevel--; camera.startsmoothzoom(currentzoomlevel); } } }); } else zoomcontrols.setvisibility(view.gone); }
please suggest me whats happening in code.
you can use code
if (params.iszoomsupported()) { final int maxzoomlevel = params.getmaxzoom(); log.i("max zoom ", "is " + maxzoomlevel); zoomcontrols.setiszoominenabled(true); zoomcontrols.setiszoomoutenabled(true); zoomcontrols.setonzoominclicklistener(new onclicklistener(){ public void onclick(view v){ if(currentzoomlevel < maxzoomlevel){ currentzoomlevel++; //mcamera.startsmoothzoom(currentzoomlevel); params.setzoom(currentzoomlevel); mcamera.setparameters(params); } } }); zoomcontrols.setonzoomoutclicklistener(new onclicklistener(){ public void onclick(view v){ if(currentzoomlevel > 0){ currentzoomlevel--; params.setzoom(currentzoomlevel); mcamera.setparameters(params); } } }); } else zoomcontrols.setvisibility(view.gone);
Comments
Post a Comment