@Override
    @TargetApi(16)
    public void onAutoFocus(boolean success, Camera camera) {
      super.onAutoFocus(success, camera);

      // whether success=true/false just let it be.
      // we got to take picture no matter what.
      takePicture();
    }
 @Override
 public void onCameraFail(FailureReason reason) {
   super.onCameraFail(reason);
   Toast.makeText(getActivity(), "Sorry, but you cannot use the camera now!", Toast.LENGTH_LONG)
       .show();
 }