Open grestuccia1 opened 8 years ago
@grestuccia1 Need more information on this. What is the device you are using? Does this happen all the time on said device?
Also got a similar report from a Xiaomi Redmi Note 3 (Android 5.1.1). Will try to replicate the issue and get back to you.
com.desmond.squarecamera.CameraFragment;
...
//private int getBackCameraID() { // return eturn CameraInfo.CAMERA_FACING_BACK; //}
private int getBackCameraID() { int numberOfCameras = Camera.getNumberOfCameras(); CameraInfo cameraInfo = new CameraInfo(); for (int i = 0; i < numberOfCameras; i++) { Camera.getCameraInfo(i, cameraInfo); if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) { return i; } } return CameraInfo.CAMERA_FACING_BACK; }
...
@boxme Happens on a varied range of devices for me like ONEPLUS, xiaomi, OPPO, Samsung. Issue does not always occur. Usually occurs when the screen has gone off and then activity is resumed after.
Are there any new developments on this, or how to fix it? I want to use this library but it keeps crashing my device.
Having the same issue, any update on this? thank you.
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.Camera.setDisplayOrientation(int)' on a null object reference at com.desmond.squarecamera.CameraFragment.determineDisplayOrientation(CameraFragment.java:325) at com.desmond.squarecamera.CameraFragment.startCameraPreview(CameraFragment.java:241) at com.desmond.squarecamera.CameraFragment.restartPreview(CameraFragment.java:234) at com.desmond.squarecamera.CameraFragment.onResume(CameraFragment.java:434) at android.support.v4.app.Fragment.performResume(Fragment.java:2020) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1107) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1234) at android.support.v4.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:2056) at android.support.v4.app.FragmentController.dispatchResume(FragmentController.java:196) at android.support.v4.app.FragmentActivity.onResumeFragments(FragmentActivity.java:505) at android.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:494) at android.support.v7.app.AppCompatActivity.onPostResume(AppCompatActivity.java:174) at android.app.Activity.performResume(Activity.java:6344) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3110) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3152) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5443) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)