1, add camera permissions
2, determine whether to support zoom
Copy Code code as follows:
public boolean issupportzoom ()
{
Boolean issuppport = true;
if (Mcamera.getparameters (). issmoothzoomsupported ())
{
Issuppport = false;
}
return issuppport;
}
3. Modify focal length
Copy Code code as follows:
public void Setzoom ()
{
if (missupportzoom)
{
Try
{
Parameters params = Mcamera.getparameters ();
Final int MAX = Params.getmaxzoom ();
if (max==0) return;
int zoomvalue = Params.getzoom ();
Trace.Log ("-----------------MAX:" +max+ "params:" +zoomvalue);
Zoomvalue + 5;
Params.setzoom (Zoomvalue);
Mcamera.setparameters (params);
Trace.Log ("is support Zoom" + params.iszoomsupported ());
}
catch (Exception e)
{
Trace.Log ("--------exception Zoom");
E.printstacktrace ();
}
}
Else
{
Trace.Log ("--------The Phone not support zoom");
}
}
4, the existence of system cameras can zoom, custom camera can not be the case, currently unable to resolve