Can't configure Camera2 API for a preview
问题 I need to set a preview for camera, to use it to scan a QR code, using Camera2 API. My problem is to configure camera. This is my code: //setting the preview surface layout file <?xml version="1.0" encoding="utf-8"?> <SurfaceView android:layout_width="250dp" android:layout_height="250dp" android:id="@+id/surfaceView" android:layout_gravity="center" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /> <TextView android:layout_width="wrap_content" android:layout_height