I was trying to reset the focus mode to continuous mode 2 seconds after user tapped to focus by using the updateParameters method, but it doesn't change at all. Below are the code snippets of the resetting part along with the tap to focus.
private View.OnTouchListener onFocusTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
cvCamera.setOnTouchListener(null);
faCamera.focus()
.whenDone(new PendingResult.Callback<FocusResult>() {
@Override
public void onResult(FocusResult focusResult) {
hideFocusIndicator();
cvCamera.setOnTouchListener(onFocusTouchListener);
}
});
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
faCamera.updateParameters(
UpdateRequest.builder()
.focusMode(
Selectors.firstAvailable(
FocusModeSelectors.continuousFocus(),
FocusModeSelectors.autoFocus(),
FocusModeSelectors.fixed()
))
.build()
);
}
}, 2000);
float x = event.getX();
float y = event.getY();
fiFocus.updateFocusIndicator((int) x, (int) y);
showFocusIndicator();
return true;
}
return false;
}
};
Hi there,
I was trying to reset the focus mode to continuous mode 2 seconds after user tapped to focus by using the
updateParameters
method, but it doesn't change at all. Below are the code snippets of the resetting part along with the tap to focus.