The code below returns:
:
06-06 17:32:38.416: DEBUG/ZoomParameters(32645): zoomSupported=false
smoothZoomSupported=false maxZoom=5
06-06 17:32:38.426: DEBUG/ZoomSetBefore(32645): parameters.getZoom()=0
06-06 17:32:38.426: DEBUG/ZoomSetAfter(32645): parameters.getZoom()=5
in the LogCat log. The preview on the screen is zoomed. However,
isZoomSupported() returns false. This is Android 2.2 API 8 running on
an HTC EVO with Android 2.2.
Any ideas on why the isZoomSupported() method is returning false?
Documentation says to run the isZoomSupported() before running
getMaxZoom() to make sure the phone hardware can Zoom.
Thank you,
Gerry
package com.soft.zoomtest1;
import android.app.Activity;
import android.os.Bundle;
import android.hardware.Camera;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import java.util.List;
public class zoomTest1 extends Activity implements
SurfaceHolder.Callback
{
private Camera camera;
private boolean zoomSupported = true, smoothZoomSupported =
true;
int maxZoom;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SurfaceView surface = (SurfaceView)findViewById(R.id.surface);
SurfaceHolder holder = surface.getHolder();
holder.addCallback(this);
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
@Override
public void surfaceCreated(SurfaceHolder holder)
{
camera = Camera.open();
}
@Override
public void surfaceDestroyed(SurfaceHolder holder)
{
camera.stopPreview();
camera.release();
}
@Override
public void surfaceChanged(SurfaceHolder arg0, int arg1, int
arg2, int arg3)
{
Camera.Parameters parameters = camera.getParameters();
zoomSupported = parameters.isZoomSupported();
smoothZoomSupported = parameters.isSmoothZoomSupported();
//if(zoomSupported) maxZoom= parameters.getMaxZoom();
maxZoom= parameters.getMaxZoom();
Log.d("ZoomParameters","zoomSupported="+zoomSupported
+"smoothZoomSupported="
+smoothZoomSupported+" maxZoom="+maxZoom);
Log.d("ZoomSetBefore","parameters.getZoom()="+parameters.getZoom());
parameters.setZoom(maxZoom);
try
{
camera.setPreviewDisplay(holder);
}
catch (IOException e) {}
camera.startPreview();
parameters.setZoom(maxZoom);
camera.setParameters(parameters);
parameters = camera.getParameters();
Log.d("ZoomSetAfter","parameters.getZoom()="+parameters.getZoom());
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en