java - Zoom control for separate devices error -
in camera layout there 2 buttons adjusting zoom parameter, 1 increasing, , 1 decreasing. on each button there onclicklistener. before increasing/decreasing zoom value use camera.parameters.iszoomsupported () function check, device support zooming. on sony z1 works perfectly, on other device (samsung galaxy s), fuction returns true, device can't zoom.
my code piece:
public void onclick(view v) { if (iszoomsupported()) { camera cam = application.getcamera(); if (cam != null) { cam.stoppreview(); parameters par = cam.getparameters(); int maxzoom = par.getmaxzoom(); int zoomvalue = par.getzoom(); zoomertek += 1; if (zoomvalue > maxzoom) { zoomvalue = maxzoom; } par.setzoom(zoomvalue); cam.setparameters(par); cam.startpreview(); } } else { toastshortwithcancel(getstring(r.string.zoom_not_supported)); } }
and little iszoomsupported() function:
private boolean iszoomsupported() { camera cam = application.getcamera(); if (cam != null) { parameters par = cam.getparameters(); return par.iszoomsupported(); } return false; }
so, problem zoom control? there mistakes? samsung device runs android 2.3.5, use api 8 programming
Comments
Post a Comment