2012-08-07 49 views
3

我正在尝试制作一个自定义相机应用程序,让用户触摸屏幕进行对焦而非拍摄照片。 Android中是否有任何相关API支持?Android触摸对焦

public void takePhoto(File photoFile, String workerName, int width, int height, int  quality) { 
if (getAutoFocusStatus()){ 
    camera.autoFocus(new AutoFocusCallback() { 
     @Override 
     public void onAutoFocus(boolean success, Camera camera) { 
      camera.takePicture(shutterCallback, rawCallback, jpegCallback); 
     } 
    }); 
}else{ 
    camera.takePicture(shutterCallback, rawCallback, jpegCallback); 
} 

this.photoFile = photoFile; 
this.workerName = workerName; 
this.imageOutputWidth = width; 
this.imageOutputHeight = height; 
} 

public void takePhoto(File photoFile, int width, int height, int quality) { 
takePhoto(photoFile, null, width, height, quality); 
} 

回答

2

如果你不想拍照,那么不要从autofocuscallback调用takepicture()。 另外,如果您想专注于用户触摸屏幕的位置,则可以使用setFocusAreas()设置聚焦区域。