You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.
I'm trying to set the aspect ratio for the preview like so:
@Override
public void onCameraOpened(CameraView cameraView) {
super.onCameraOpened(cameraView);
for (AspectRatio ar : cameraView.getSupportedAspectRatios()) {
if (ar.getX() == 3 && ar.getY() == 2) {
cameraView.setAspectRatio(ar); //NPE exception
break;
}
}
}
and I get a NPE exception:
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.SortedSet.last()' on a null object reference
at com.google.android.cameraview.Camera1.adjustCameraParameters(Camera1.java:333)
at com.google.android.cameraview.Camera1.setAspectRatio(Camera1.java:174)
at com.google.android.cameraview.CameraView.setAspectRatio(CameraView.java:346)
What I'm trying to accomplish is to have the same aspectRatio for the preview and the resulted bitmap (so I can crop the photo on a specific location)
Is there another way to accomplish this?
The text was updated successfully, but these errors were encountered:
I'm trying to set the aspect ratio for the preview like so:
and I get a NPE exception:
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.SortedSet.last()' on a null object reference
at com.google.android.cameraview.Camera1.adjustCameraParameters(Camera1.java:333)
at com.google.android.cameraview.Camera1.setAspectRatio(Camera1.java:174)
at com.google.android.cameraview.CameraView.setAspectRatio(CameraView.java:346)
What I'm trying to accomplish is to have the same aspectRatio for the preview and the resulted bitmap (so I can crop the photo on a specific location)
Is there another way to accomplish this?
The text was updated successfully, but these errors were encountered: