问:
By Using Camera 2 api while using External USB Camera the Captured image are just black Images and Thumpnails
```<code>package com.example.camera4;

public class MainActivity extends AppCompatActivity {
    private static final String TAG = "Main";
    private Button takePictureButton,nextactivity;
    private TextureView textureView;
    private ImageView imageView;

    private static final SparseIntArray ORIENTATIONS = new SparseIntArray();

    static {
        ORIENTATIONS.append(Surface.ROTATION_0, 90);
        ORIENTATIONS.append(Surface.ROTATION_90, 0);
        ORIENTATIONS.append(Surface.ROTATION_180, 270);
        ORIENTATIONS.append(Surface.ROTATION_270, 180);
    }

    private String cameraId;
    protected CameraDevice cameraDevice;
    protected CameraCaptureSession cameraCaptureSessions;

    protected CaptureRequest.Builder captureRequestBuilder;
    private Size imageDimension;
    private ImageReader imageReader;
    private File file;
    private static final int REQUEST_CAMERA_PERMISSION = 200;
    private boolean mFlashSupported;
    private Handler mBackgroundHandler;
    private HandlerThread mBackgroundThread;
    private String folderName="Myphotodir";
    private File folder;
    byte[] bytes1 ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        textureView = (TextureView) findViewById(R.id.texture);
        assert textureView != null;
        textureView.setSurfaceTextureListener(textureListener);
        takePictureButton = findViewById(R.id.btn_takepicture);
        imageView = findViewById(R.id.imageview);
        assert takePictureButton != null;
        nextactivity = findViewById(R.id.nextactivity);
        nextactivity.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent =  new Intent(MainActivity.this,AndroidCameraApi.class);
                startActivity(intent);
            }
        });
        takePictureButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                takePicture();
            }
        });
    }

    TextureView.SurfaceTextureListener textureListener = new TextureView.SurfaceTextureListener() {
        @Override
        public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
            //open your camera here
            openCamera();
        }

        @Override
        public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
            // Transform you image captured size according to the surface width and height
        }

        @Override
        public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
            return false;
        }

        @Override
        public void onSurfaceTextureUpdated(SurfaceTexture surface) {
        }
    };
    private final CameraDevice.StateCallback stateCallback = new CameraDevice.StateCallback() {
        @Override
        public void onOpened(CameraDevice camera) {
            //This is called when the camera is open
            Log.e(TAG, "onOpened");
            cameraDevice = camera;
            createCameraPreview();
        }

        @Override
        public void onDisconnected(CameraDevice camera) {
            cameraDevice = camera;
            closeCamera();
        }

        @Override
        public void onError(CameraDevice camera, int error) {
            cameraDevice = camera;
            closeCamera();
        }
    };
    final CameraCaptureSession.CaptureCallback captureCallbackListener = new CameraCaptureSession.CaptureCallback() {

        @Override
        public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request, TotalCaptureResult result) {
            super.onCaptureCompleted(session, request, result);
            Toast.makeText(MainActivity.this, "Saved:" + file, Toast.LENGTH_SHORT).show();
            createCameraPreview();

        }
    };

    protected void startBackgroundThread() {
        mBackgroundThread = new HandlerThread("Camera Background");
        mBackgroundThread.start();
        mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
    }

    protected void stopBackgroundThread() {
        mBackgroundThread.quitSafely();
        try {
            mBackgroundThread.join();
            mBackgroundThread = null;
            mBackgroundHandler = null;
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    protected void takePicture() {
        if (null == cameraDevice) {
            Log.e(TAG, "cameraDevice is null");
            return;
        }
        Log.d("takePicture()","started");
        CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
        try {
            CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraDevice.getId());
            Size[] jpegSizes = null;
            if (characteristics != null) {
                jpegSizes = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP).getOutputSizes(ImageFormat.JPEG);
            }
            int width = 640;
            int height = 480;
            if (jpegSizes != null && 0 < jpegSizes.length) {
                width = jpegSizes[0].getWidth();
                height = jpegSizes[0].getHeight();
            }
            ImageReader reader = ImageReader.newInstance(width, height, ImageFormat.JPEG, 1);
            List<Surface> outputSurfaces = new ArrayList<Surface>(1);
            outputSurfaces.add(reader.getSurface());
            outputSurfaces.add(new Surface(textureView.getSurfaceTexture()));
            final CaptureRequest.Builder captureBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
            captureBuilder.addTarget(reader.getSurface());
            captureBuilder.set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO);
            // Orientation
            int rotation = getWindowManager().getDefaultDisplay().getRotation();
            captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, ORIENTATIONS.get(rotation));
            folder = new File(folderName);
            String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
            String imageFilename = "image"+".jpg";
            file = new File(getExternalFilesDir(folderName),"/"+imageFilename);
            if (!folder.exists())
            {
                folder.mkdirs();
            }

            ImageReader.OnImageAvailableListener readerListener = new ImageReader.OnImageAvailableListener() {
                @Override
                public void onImageAvailable(ImageReader reader1) {
                    Log.d("image available","true");
                    Image image = null;
                    try {
                        image = reader1.acquireNextImage();
                        ByteBuffer buffer = image.getPlanes()[0].getBuffer();
                        byte[] bytes = new byte[buffer.capacity()];
                        buffer.get(bytes);
                        save(bytes);
                        image.close();
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }

                private void save(byte[] bytes) throws IOException {
                    Log.d("save()","called");
                    OutputStream output = null;
                    try {
                        output = new FileOutputStream(file);
                        output.write(bytes);
                        output.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }

            };
            reader.setOnImageAvailableListener(readerListener, mBackgroundHandler);
            final CameraCaptureSession.CaptureCallback captureListener = new CameraCaptureSession.CaptureCallback() {

                @Override
                public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request, TotalCaptureResult result) {
                    super.onCaptureCompleted(session, request, result);

                    Toast.makeText(MainActivity.this, "Saved:" + file.getPath(), Toast.LENGTH_LONG).show();
                    createCameraPreview();
                    Log.d("image location=",String.valueOf(file));
                    Log.d("image result=",String.valueOf(result));
                }

                public byte[] getBytes(InputStream inputStream) throws IOException {

                    ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();
                    int bufferSize = 1024;
                    byte[] buffer = new byte[bufferSize];

                    int len = 0;
                    while ((len = inputStream.read(buffer)) != -1) {
                        byteBuffer.write(buffer, 0, len);
                        bytes1 =byteBuffer.toByteArray();
                    }
                    return bytes1;
                    }
            };
            cameraDevice.createCaptureSession(outputSurfaces, new CameraCaptureSession.StateCallback() {
                @Override
                public void onConfigured(CameraCaptureSession session) {
                    try {
                        session.capture(captureBuilder.build(), captureListener, mBackgroundHandler);
                    } catch (CameraAccessException e) {
                        e.printStackTrace();
                    }
                }

                @Override
                public void onConfigureFailed(CameraCaptureSession session) {
                }
            }, mBackgroundHandler);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }

    protected void createCameraPreview() {
        try {
            SurfaceTexture texture = textureView.getSurfaceTexture();
            assert texture != null;
            texture.setDefaultBufferSize(imageDimension.getWidth(), imageDimension.getHeight());
            Surface surface = new Surface(texture);
            captureRequestBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
            captureRequestBuilder.addTarget(surface);
            cameraDevice.createCaptureSession(Arrays.asList(surface), new CameraCaptureSession.StateCallback() {
                @Override
                public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {
                    //The camera is already closed
                    if (null == cameraDevice) {
                        return;
                    }
                    // When the session is ready, we start displaying the preview.
                    cameraCaptureSessions = cameraCaptureSession;
                    updatePreview();
                }

                @Override
                public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {
                    Toast.makeText(MainActivity.this, "Configuration change", Toast.LENGTH_SHORT).show();
                }
            }, null);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }

    private void openCamera() {
        CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
        Log.e(TAG, "is camera open");
        try {
            cameraId = manager.getCameraIdList()[0];
            CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
            StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
            assert map != null;
            imageDimension = map.getOutputSizes(SurfaceTexture.class)[0];
            // Add permission for camera and let user grant the permission
            if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CAMERA_PERMISSION);
                return;
            }
            manager.openCamera(cameraId, stateCallback, null);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
        Log.e(TAG, "openCamera X");
    }

    protected void updatePreview() {
        if (null == cameraDevice) {
            Log.e(TAG, "updatePreview error, return");
        }
        captureRequestBuilder.set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO);
        captureRequestBuilder.set(CaptureRequest.CONTROL_AWB_MODE, CaptureRequest.CONTROL_AWB_MODE_AUTO);
        try {
            cameraCaptureSessions.setRepeatingRequest(captureRequestBuilder.build(), null, mBackgroundHandler);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if (requestCode == REQUEST_CAMERA_PERMISSION) {
            if (grantResults[0] == PackageManager.PERMISSION_DENIED) {
                // close the app
                Toast.makeText(MainActivity.this, "Sorry!!!, you can't use this app without granting permission", Toast.LENGTH_LONG).show();
                finish();
            }
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.e(TAG, "onResume");
        startBackgroundThread();
        if (textureView.isAvailable()) {
            openCamera();
        } else {
            textureView.setSurfaceTextureListener(textureListener);
        }
    }

    @Override
    protected void onPause() {
        Log.e(TAG, "onPause");
        //closeCamera();
        stopBackgroundThread();
        closeCamera();
        super.onPause();
    }
    @MainThread
    private void closeCamera() {
        if (null != cameraDevice) {
            cameraDevice.close();
            cameraDevice = null;
        }
        if (null != imageReader) {
            imageReader.close();
            imageReader = null;
        }
    }
}
</code>```

Code Explanation

While the app started the camera has been opened by calling openCamera(); function In that function I have been getting the manifest permission and then opening the camera [0]
While Clicking "takePicture(); function" I have been getting the captured image by using "

ImageReader reader = ImageReader.newInstance(width, height, ImageFormat.JPEG, 1);"

I have been getting only one image and then by using

ImageReader.OnImageAvailableListener inside the listener I have been using
image = reader1.acquireNextImage(); to acqure the captured image

then I have been converting the image to byte and then pass it to the "save() function" in that function I have been saving my captured image and then save them in my local storage

In reader.setOnImageAvailableListener I have been calling onCaptureCompleted to show the image location and then calling the "createCameraPreview() Function"

Description

I have been using the above code to capture an image and save it in local storage

While capturing the image by using a mobile phone with the mobile internal camera it is working properly

While I tried to take pictures from the POS Billing machine using the External USB camera the camera shows the live feed in ` While I click the "Take Picture Button" The image saved just a black image

While clicking the "Take Picture Button" it successfully passes through "ImageReader.OnImageAvailableListener" which is used to get the acquirenextimage() and call the "save() function" Which is used to save images in my local storage

What Do I need

The above code is working properly when I capture images from my phone and when I have been trying from my POS device the using EXternal USB camera it just saves a black image

Please provide me an explanation of what I am doing wrong or why the problem acquires the POS device only.

My LogCat

```<code>---------------------------- PROCESS ENDED (10183) for package com.example.camera4 ----------------------------
2022-12-23 10:48:56.977   561-7931  ActivityManager         system_process                       E  getPackageFerformanceMode--ComponentInfo{com.example.camera4/com.example.camera4.MainActivity}----com.example.camera4
2022-12-23 10:48:56.980   561-5053  ActivityManager         system_process                       E  getPackageFerformanceMode--ComponentInfo{com.example.camera4/com.example.camera4.MainActivity}----com.example.camera4
---------------------------- PROCESS STARTED (11010) for package com.example.camera4 ----------------------------
2022-12-23 10:48:57.700 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden field Landroid/os/Trace;->TRACE_TAG_APP:J (light greylist, reflection)
2022-12-23 10:48:57.700 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (light greylist, reflection)
2022-12-23 10:48:57.841 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking)
2022-12-23 10:48:57.841 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking)
2022-12-23 10:48:57.841 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking)
2022-12-23 10:48:57.841 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking)
2022-12-23 10:48:57.890 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden field Landroid/view/WindowInsets;->CONSUMED:Landroid/view/WindowInsets; (light greylist, reflection)
2022-12-23 10:48:57.958 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
2022-12-23 10:48:57.959 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
2022-12-23 10:48:58.130 11010-11010 Main                    com.example.camera4                  E  onResume
2022-12-23 10:48:58.142 11010-11010 OpenGLRenderer          com.example.camera4                  D  Skia GL Pipeline
2022-12-23 10:48:58.212 11010-11036 mali_so                 com.example.camera4                  I  [File] : hardware/arm/mali_so/driver/product/base/src/mali_base_kbase.c; [Line] : 876; [Func] : base_context_deal_with_version_affairs_rk_ext;
                                                                                arm_release_ver of this mali_so is 'r18p0-01rel0', rk_so_ver is '15@0'.
2022-12-23 10:48:58.213 11010-11036 mali_so                 com.example.camera4                  D  [File] : hardware/arm/mali_so/driver/product/base/src/mali_base_kbase.c; [Line] : 881; [Func] : base_context_deal_with_version_affairs_rk_ext;
                                                                                current process is NOT sf, to bail out.
2022-12-23 10:48:58.236 11010-11036 ConfigStore             com.example.camera4                  I  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2022-12-23 10:48:58.236 11010-11036 ConfigStore             com.example.camera4                  I  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
2022-12-23 10:48:58.236 11010-11036 OpenGLRenderer          com.example.camera4                  I  Initialized EGL, version 1.4
2022-12-23 10:48:58.236 11010-11036 OpenGLRenderer          com.example.camera4                  D  Swap behavior 2
2022-12-23 10:48:58.247 11010-11036 mali_winsys             com.example.camera4                  D  EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
2022-12-23 10:48:58.280 11010-11010 Main                    com.example.camera4                  E  is camera open
2022-12-23 10:48:58.281 11010-11010 CameraManagerGlobal     com.example.camera4                  I  Connecting to camera service
2022-12-23 10:48:58.294 11010-11010 camera level            com.example.camera4                  D  4
2022-12-23 10:48:59.024 11010-11010 Main                    com.example.camera4                  E  openCamera X
2022-12-23 10:48:59.086 11010-11036 GRALLOC-ROCKCHIP        com.example.camera4                  D  RK_GRAPHICS_VER=commit-id:dc44fa2
2022-12-23 10:48:59.110 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:48:59.146 11010-11036 chatty                  com.example.camera4                  I  uid=10072(com.example.camera4) RenderThread identical 10 lines
2022-12-23 10:48:59.150 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:48:59.153 11010-11036 OpenGLRenderer          com.example.camera4                  I  Davey! duration=973ms; Flags=0, IntendedVsync=17676652385667, Vsync=17676735718997, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=17676746187254, AnimationStart=17676746254045, PerformTraversalsStart=17676746778170, DrawStart=17676751392046, SyncQueued=17677553044460, SyncStart=17677553731626, IssueDrawCommandsStart=17677553857043, SwapBuffers=17677624795634, FrameCompleted=17677627029217, DequeueBufferDuration=510000, QueueBufferDuration=417000,
2022-12-23 10:48:59.171 11010-11010 Choreographer           com.example.camera4                  I  Skipped 53 frames!  The application may be doing too much work on its main thread.
2022-12-23 10:48:59.185 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden method Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V (light greylist, reflection)
2022-12-23 10:48:59.185 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden method Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V (light greylist, reflection)
2022-12-23 10:48:59.185 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden method Landroid/os/Trace;->traceCounter(JLjava/lang/String;I)V (light greylist, reflection)
2022-12-23 10:48:59.202 11010-11010 Main                    com.example.camera4                  E  onOpened
2022-12-23 10:48:59.206 11010-11036 OpenGLRenderer          com.example.camera4                  I  Davey! duration=927ms; Flags=0, IntendedVsync=17676752273366, Vsync=17677635606664, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=17677645137927, AnimationStart=17677645220761, PerformTraversalsStart=17677646040052, DrawStart=17677646535011, SyncQueued=17677657101220, SyncStart=17677657157803, IssueDrawCommandsStart=17677657277970, SwapBuffers=17677676895764, FrameCompleted=17677679493347, DequeueBufferDuration=190000, QueueBufferDuration=661000,
2022-12-23 10:48:59.476 11010-11024 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:48:59.483 11010-11024 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:48:59.503 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:48:59.507 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:48:59.518 11010-11024 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:48:59.524 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:49:19.945 11010-11024 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:49:19.986 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:49:19.990 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:49:19.999 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:49:20.055 11010-11010 takePicture()           com.example.camera4                  D  started
2022-12-23 10:49:20.476 11010-11035 image available         com.example.camera4                  D  true
2022-12-23 10:49:20.477 11010-11035 save()                  com.example.camera4                  D  called
2022-12-23 10:49:20.794 11010-11010 example.camera          com.example.camera4                  W  Long monitor contention with owner Camera Background (11035) at void android.hardware.camera2.impl.CameraDeviceImpl.createCaptureSessionInternal(android.hardware.camera2.params.InputConfiguration, java.util.List, android.hardware.camera2.CameraCaptureSession$StateCallback, java.util.concurrent.Executor, int, android.hardware.camera2.CaptureRequest)(CameraDeviceImpl.java:636) waiters=0 in void android.hardware.camera2.impl.CameraDeviceImpl$4.run() for 270ms
2022-12-23 10:49:20.793 11010-11035 image location=         com.example.camera4                  D  /storage/emulated/0/Android/data/com.example.camera4/files/Myphotodir/image.jpg
2022-12-23 10:49:20.795 11010-11035 image result=           com.example.camera4                  D  android.hardware.camera2.TotalCaptureResult@37e6a4f
2022-12-23 10:49:20.805 11010-11010 data                    com.example.camera4                  D  onActivityResult: bytes size=2986
2022-12-23 10:49:20.807 11010-11010 data                    com.example.camera4                  D
2022-12-23 10:49:20.833 11010-11023 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:49:20.837 11010-11023 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:49:20.853 11010-11059 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:49:20.869 11010-11036 mali_winsys             com.example.camera4                  D  EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
2022-12-23 10:49:20.879 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:49:20.882 11010-11036 chatty                  com.example.camera4                  I  uid=10072(com.example.camera4) RenderThread identical 1 line
2022-12-23 10:49:20.885 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:49:20.894 11010-11064 NetworkSecurityConfig   com.example.camera4                  D  No Network Security Config specified, using platform default
2022-12-23 10:49:20.937 11010-11019 System                  com.example.camera4                  W  A resource failed to call release.
2022-12-23 10:49:20.975 11010-11019 System                  com.example.camera4                  W  A resource failed to call release.
2022-12-23 10:49:20.976 11010-11019 System                  com.example.camera4                  W  A resource failed to call close.
2022-12-23 10:49:22.292 11010-11010 Volley response         com.example.camera4                  D  {"status":200,"body":"https:\/\/b2b-partnerapp-images.s3.ap-south-1.amazonaws.com\/itemweightdetails\/66955be7-47ec-4820-8cc9-0ac64fcebd8b.jpeg","isBase64Encoded":true}
2022-12-23 10:49:24.031 11010-11036 libEGL                  com.example.camera4                  W  EGLNativeWindowType 0x7995738010 disconnect failed
</code>```

Body:
package com.example.camera4;

public class MainActivity extends AppCompatActivity {
    private static final String TAG = "Main";
    private Button takePictureButton,nextactivity;
    private TextureView textureView;
    private ImageView imageView;

    private static final SparseIntArray ORIENTATIONS = new SparseIntArray();

    static {
        ORIENTATIONS.append(Surface.ROTATION_0, 90);
        ORIENTATIONS.append(Surface.ROTATION_90, 0);
        ORIENTATIONS.append(Surface.ROTATION_180, 270);
        ORIENTATIONS.append(Surface.ROTATION_270, 180);
    }

    private String cameraId;
    protected CameraDevice cameraDevice;
    protected CameraCaptureSession cameraCaptureSessions;

    protected CaptureRequest.Builder captureRequestBuilder;
    private Size imageDimension;
    private ImageReader imageReader;
    private File file;
    private static final int REQUEST_CAMERA_PERMISSION = 200;
    private boolean mFlashSupported;
    private Handler mBackgroundHandler;
    private HandlerThread mBackgroundThread;
    private String folderName="Myphotodir";
    private File folder;
    byte[] bytes1 ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        textureView = (TextureView) findViewById(R.id.texture);
        assert textureView != null;
        textureView.setSurfaceTextureListener(textureListener);
        takePictureButton = findViewById(R.id.btn_takepicture);
        imageView = findViewById(R.id.imageview);
        assert takePictureButton != null;
        nextactivity = findViewById(R.id.nextactivity);
        nextactivity.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent =  new Intent(MainActivity.this,AndroidCameraApi.class);
                startActivity(intent);
            }
        });
        takePictureButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                takePicture();
            }
        });
    }

    TextureView.SurfaceTextureListener textureListener = new TextureView.SurfaceTextureListener() {
        @Override
        public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
            //open your camera here
            openCamera();
        }

        @Override
        public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
            // Transform you image captured size according to the surface width and height
        }

        @Override
        public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
            return false;
        }

        @Override
        public void onSurfaceTextureUpdated(SurfaceTexture surface) {
        }
    };
    private final CameraDevice.StateCallback stateCallback = new CameraDevice.StateCallback() {
        @Override
        public void onOpened(CameraDevice camera) {
            //This is called when the camera is open
            Log.e(TAG, "onOpened");
            cameraDevice = camera;
            createCameraPreview();
        }

        @Override
        public void onDisconnected(CameraDevice camera) {
            cameraDevice = camera;
            closeCamera();
        }

        @Override
        public void onError(CameraDevice camera, int error) {
            cameraDevice = camera;
            closeCamera();
        }
    };
    final CameraCaptureSession.CaptureCallback captureCallbackListener = new CameraCaptureSession.CaptureCallback() {

        @Override
        public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request, TotalCaptureResult result) {
            super.onCaptureCompleted(session, request, result);
            Toast.makeText(MainActivity.this, "Saved:" + file, Toast.LENGTH_SHORT).show();
            createCameraPreview();

        }
    };

    protected void startBackgroundThread() {
        mBackgroundThread = new HandlerThread("Camera Background");
        mBackgroundThread.start();
        mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
    }

    protected void stopBackgroundThread() {
        mBackgroundThread.quitSafely();
        try {
            mBackgroundThread.join();
            mBackgroundThread = null;
            mBackgroundHandler = null;
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    protected void takePicture() {
        if (null == cameraDevice) {
            Log.e(TAG, "cameraDevice is null");
            return;
        }
        Log.d("takePicture()","started");
        CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
        try {
            CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraDevice.getId());
            Size[] jpegSizes = null;
            if (characteristics != null) {
                jpegSizes = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP).getOutputSizes(ImageFormat.JPEG);
            }
            int width = 640;
            int height = 480;
            if (jpegSizes != null && 0 < jpegSizes.length) {
                width = jpegSizes[0].getWidth();
                height = jpegSizes[0].getHeight();
            }
            ImageReader reader = ImageReader.newInstance(width, height, ImageFormat.JPEG, 1);
            List<Surface> outputSurfaces = new ArrayList<Surface>(1);
            outputSurfaces.add(reader.getSurface());
            outputSurfaces.add(new Surface(textureView.getSurfaceTexture()));
            final CaptureRequest.Builder captureBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
            captureBuilder.addTarget(reader.getSurface());
            captureBuilder.set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO);
            // Orientation
            int rotation = getWindowManager().getDefaultDisplay().getRotation();
            captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, ORIENTATIONS.get(rotation));
            folder = new File(folderName);
            String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
            String imageFilename = "image"+".jpg";
            file = new File(getExternalFilesDir(folderName),"/"+imageFilename);
            if (!folder.exists())
            {
                folder.mkdirs();
            }

            ImageReader.OnImageAvailableListener readerListener = new ImageReader.OnImageAvailableListener() {
                @Override
                public void onImageAvailable(ImageReader reader1) {
                    Log.d("image available","true");
                    Image image = null;
                    try {
                        image = reader1.acquireNextImage();
                        ByteBuffer buffer = image.getPlanes()[0].getBuffer();
                        byte[] bytes = new byte[buffer.capacity()];
                        buffer.get(bytes);
                        save(bytes);
                        image.close();
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }

                private void save(byte[] bytes) throws IOException {
                    Log.d("save()","called");
                    OutputStream output = null;
                    try {
                        output = new FileOutputStream(file);
                        output.write(bytes);
                        output.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }

            };
            reader.setOnImageAvailableListener(readerListener, mBackgroundHandler);
            final CameraCaptureSession.CaptureCallback captureListener = new CameraCaptureSession.CaptureCallback() {

                @Override
                public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request, TotalCaptureResult result) {
                    super.onCaptureCompleted(session, request, result);

                    Toast.makeText(MainActivity.this, "Saved:" + file.getPath(), Toast.LENGTH_LONG).show();
                    createCameraPreview();
                    Log.d("image location=",String.valueOf(file));
                    Log.d("image result=",String.valueOf(result));
                }

                public byte[] getBytes(InputStream inputStream) throws IOException {

                    ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();
                    int bufferSize = 1024;
                    byte[] buffer = new byte[bufferSize];

                    int len = 0;
                    while ((len = inputStream.read(buffer)) != -1) {
                        byteBuffer.write(buffer, 0, len);
                        bytes1 =byteBuffer.toByteArray();
                    }
                    return bytes1;
                    }
            };
            cameraDevice.createCaptureSession(outputSurfaces, new CameraCaptureSession.StateCallback() {
                @Override
                public void onConfigured(CameraCaptureSession session) {
                    try {
                        session.capture(captureBuilder.build(), captureListener, mBackgroundHandler);
                    } catch (CameraAccessException e) {
                        e.printStackTrace();
                    }
                }

                @Override
                public void onConfigureFailed(CameraCaptureSession session) {
                }
            }, mBackgroundHandler);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }

    protected void createCameraPreview() {
        try {
            SurfaceTexture texture = textureView.getSurfaceTexture();
            assert texture != null;
            texture.setDefaultBufferSize(imageDimension.getWidth(), imageDimension.getHeight());
            Surface surface = new Surface(texture);
            captureRequestBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
            captureRequestBuilder.addTarget(surface);
            cameraDevice.createCaptureSession(Arrays.asList(surface), new CameraCaptureSession.StateCallback() {
                @Override
                public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {
                    //The camera is already closed
                    if (null == cameraDevice) {
                        return;
                    }
                    // When the session is ready, we start displaying the preview.
                    cameraCaptureSessions = cameraCaptureSession;
                    updatePreview();
                }

                @Override
                public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {
                    Toast.makeText(MainActivity.this, "Configuration change", Toast.LENGTH_SHORT).show();
                }
            }, null);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }

    private void openCamera() {
        CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
        Log.e(TAG, "is camera open");
        try {
            cameraId = manager.getCameraIdList()[0];
            CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
            StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
            assert map != null;
            imageDimension = map.getOutputSizes(SurfaceTexture.class)[0];
            // Add permission for camera and let user grant the permission
            if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CAMERA_PERMISSION);
                return;
            }
            manager.openCamera(cameraId, stateCallback, null);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
        Log.e(TAG, "openCamera X");
    }

    protected void updatePreview() {
        if (null == cameraDevice) {
            Log.e(TAG, "updatePreview error, return");
        }
        captureRequestBuilder.set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO);
        captureRequestBuilder.set(CaptureRequest.CONTROL_AWB_MODE, CaptureRequest.CONTROL_AWB_MODE_AUTO);
        try {
            cameraCaptureSessions.setRepeatingRequest(captureRequestBuilder.build(), null, mBackgroundHandler);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if (requestCode == REQUEST_CAMERA_PERMISSION) {
            if (grantResults[0] == PackageManager.PERMISSION_DENIED) {
                // close the app
                Toast.makeText(MainActivity.this, "Sorry!!!, you can't use this app without granting permission", Toast.LENGTH_LONG).show();
                finish();
            }
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.e(TAG, "onResume");
        startBackgroundThread();
        if (textureView.isAvailable()) {
            openCamera();
        } else {
            textureView.setSurfaceTextureListener(textureListener);
        }
    }

    @Override
    protected void onPause() {
        Log.e(TAG, "onPause");
        //closeCamera();
        stopBackgroundThread();
        closeCamera();
        super.onPause();
    }
    @MainThread
    private void closeCamera() {
        if (null != cameraDevice) {
            cameraDevice.close();
            cameraDevice = null;
        }
        if (null != imageReader) {
            imageReader.close();
            imageReader = null;
        }
    }
}

Code Explanation

While the app started the camera has been opened by calling openCamera(); function In that function I have been getting the manifest permission and then opening the camera [0]
While Clicking "takePicture(); function" I have been getting the captured image by using "

ImageReader reader = ImageReader.newInstance(width, height, ImageFormat.JPEG, 1);"

I have been getting only one image and then by using

ImageReader.OnImageAvailableListener inside the listener I have been using
image = reader1.acquireNextImage(); to acqure the captured image

then I have been converting the image to byte and then pass it to the "save() function" in that function I have been saving my captured image and then save them in my local storage

In reader.setOnImageAvailableListener I have been calling onCaptureCompleted to show the image location and then calling the "createCameraPreview() Function"

Description

I have been using the above code to capture an image and save it in local storage

While capturing the image by using a mobile phone with the mobile internal camera it is working properly

While I tried to take pictures from the POS Billing machine using the External USB camera the camera shows the live feed in ` While I click the "Take Picture Button" The image saved just a black image

While clicking the "Take Picture Button" it successfully passes through "ImageReader.OnImageAvailableListener" which is used to get the acquirenextimage() and call the "save() function" Which is used to save images in my local storage

What Do I need

The above code is working properly when I capture images from my phone and when I have been trying from my POS device the using EXternal USB camera it just saves a black image

Please provide me an explanation of what I am doing wrong or why the problem acquires the POS device only.

My LogCat

---------------------------- PROCESS ENDED (10183) for package com.example.camera4 ----------------------------
2022-12-23 10:48:56.977   561-7931  ActivityManager         system_process                       E  getPackageFerformanceMode--ComponentInfo{com.example.camera4/com.example.camera4.MainActivity}----com.example.camera4
2022-12-23 10:48:56.980   561-5053  ActivityManager         system_process                       E  getPackageFerformanceMode--ComponentInfo{com.example.camera4/com.example.camera4.MainActivity}----com.example.camera4
---------------------------- PROCESS STARTED (11010) for package com.example.camera4 ----------------------------
2022-12-23 10:48:57.700 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden field Landroid/os/Trace;->TRACE_TAG_APP:J (light greylist, reflection)
2022-12-23 10:48:57.700 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (light greylist, reflection)
2022-12-23 10:48:57.841 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking)
2022-12-23 10:48:57.841 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking)
2022-12-23 10:48:57.841 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking)
2022-12-23 10:48:57.841 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking)
2022-12-23 10:48:57.890 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden field Landroid/view/WindowInsets;->CONSUMED:Landroid/view/WindowInsets; (light greylist, reflection)
2022-12-23 10:48:57.958 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
2022-12-23 10:48:57.959 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
2022-12-23 10:48:58.130 11010-11010 Main                    com.example.camera4                  E  onResume
2022-12-23 10:48:58.142 11010-11010 OpenGLRenderer          com.example.camera4                  D  Skia GL Pipeline
2022-12-23 10:48:58.212 11010-11036 mali_so                 com.example.camera4                  I  [File] : hardware/arm/mali_so/driver/product/base/src/mali_base_kbase.c; [Line] : 876; [Func] : base_context_deal_with_version_affairs_rk_ext;
                                                                                arm_release_ver of this mali_so is 'r18p0-01rel0', rk_so_ver is '15@0'.
2022-12-23 10:48:58.213 11010-11036 mali_so                 com.example.camera4                  D  [File] : hardware/arm/mali_so/driver/product/base/src/mali_base_kbase.c; [Line] : 881; [Func] : base_context_deal_with_version_affairs_rk_ext;
                                                                                current process is NOT sf, to bail out.
2022-12-23 10:48:58.236 11010-11036 ConfigStore             com.example.camera4                  I  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2022-12-23 10:48:58.236 11010-11036 ConfigStore             com.example.camera4                  I  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
2022-12-23 10:48:58.236 11010-11036 OpenGLRenderer          com.example.camera4                  I  Initialized EGL, version 1.4
2022-12-23 10:48:58.236 11010-11036 OpenGLRenderer          com.example.camera4                  D  Swap behavior 2
2022-12-23 10:48:58.247 11010-11036 mali_winsys             com.example.camera4                  D  EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
2022-12-23 10:48:58.280 11010-11010 Main                    com.example.camera4                  E  is camera open
2022-12-23 10:48:58.281 11010-11010 CameraManagerGlobal     com.example.camera4                  I  Connecting to camera service
2022-12-23 10:48:58.294 11010-11010 camera level            com.example.camera4                  D  4
2022-12-23 10:48:59.024 11010-11010 Main                    com.example.camera4                  E  openCamera X
2022-12-23 10:48:59.086 11010-11036 GRALLOC-ROCKCHIP        com.example.camera4                  D  RK_GRAPHICS_VER=commit-id:dc44fa2
2022-12-23 10:48:59.110 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:48:59.146 11010-11036 chatty                  com.example.camera4                  I  uid=10072(com.example.camera4) RenderThread identical 10 lines
2022-12-23 10:48:59.150 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:48:59.153 11010-11036 OpenGLRenderer          com.example.camera4                  I  Davey! duration=973ms; Flags=0, IntendedVsync=17676652385667, Vsync=17676735718997, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=17676746187254, AnimationStart=17676746254045, PerformTraversalsStart=17676746778170, DrawStart=17676751392046, SyncQueued=17677553044460, SyncStart=17677553731626, IssueDrawCommandsStart=17677553857043, SwapBuffers=17677624795634, FrameCompleted=17677627029217, DequeueBufferDuration=510000, QueueBufferDuration=417000,
2022-12-23 10:48:59.171 11010-11010 Choreographer           com.example.camera4                  I  Skipped 53 frames!  The application may be doing too much work on its main thread.
2022-12-23 10:48:59.185 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden method Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V (light greylist, reflection)
2022-12-23 10:48:59.185 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden method Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V (light greylist, reflection)
2022-12-23 10:48:59.185 11010-11010 example.camera          com.example.camera4                  W  Accessing hidden method Landroid/os/Trace;->traceCounter(JLjava/lang/String;I)V (light greylist, reflection)
2022-12-23 10:48:59.202 11010-11010 Main                    com.example.camera4                  E  onOpened
2022-12-23 10:48:59.206 11010-11036 OpenGLRenderer          com.example.camera4                  I  Davey! duration=927ms; Flags=0, IntendedVsync=17676752273366, Vsync=17677635606664, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=17677645137927, AnimationStart=17677645220761, PerformTraversalsStart=17677646040052, DrawStart=17677646535011, SyncQueued=17677657101220, SyncStart=17677657157803, IssueDrawCommandsStart=17677657277970, SwapBuffers=17677676895764, FrameCompleted=17677679493347, DequeueBufferDuration=190000, QueueBufferDuration=661000,
2022-12-23 10:48:59.476 11010-11024 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:48:59.483 11010-11024 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:48:59.503 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:48:59.507 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:48:59.518 11010-11024 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:48:59.524 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:49:19.945 11010-11024 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:49:19.986 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:49:19.990 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:49:19.999 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:49:20.055 11010-11010 takePicture()           com.example.camera4                  D  started
2022-12-23 10:49:20.476 11010-11035 image available         com.example.camera4                  D  true
2022-12-23 10:49:20.477 11010-11035 save()                  com.example.camera4                  D  called
2022-12-23 10:49:20.794 11010-11010 example.camera          com.example.camera4                  W  Long monitor contention with owner Camera Background (11035) at void android.hardware.camera2.impl.CameraDeviceImpl.createCaptureSessionInternal(android.hardware.camera2.params.InputConfiguration, java.util.List, android.hardware.camera2.CameraCaptureSession$StateCallback, java.util.concurrent.Executor, int, android.hardware.camera2.CaptureRequest)(CameraDeviceImpl.java:636) waiters=0 in void android.hardware.camera2.impl.CameraDeviceImpl$4.run() for 270ms
2022-12-23 10:49:20.793 11010-11035 image location=         com.example.camera4                  D  /storage/emulated/0/Android/data/com.example.camera4/files/Myphotodir/image.jpg
2022-12-23 10:49:20.795 11010-11035 image result=           com.example.camera4                  D  android.hardware.camera2.TotalCaptureResult@37e6a4f
2022-12-23 10:49:20.805 11010-11010 data                    com.example.camera4                  D  onActivityResult: bytes size=2986
2022-12-23 10:49:20.807 11010-11010 data                    com.example.camera4                  D
2022-12-23 10:49:20.833 11010-11023 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:49:20.837 11010-11023 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:49:20.853 11010-11059 [Gralloc]               com.example.camera4                  I  for nv12, w : 160, h : 120, pixel_stride : 160, byte_stride : 160, size : 38400; internalHeight : 120.
2022-12-23 10:49:20.869 11010-11036 mali_winsys             com.example.camera4                  D  EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
2022-12-23 10:49:20.879 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:49:20.882 11010-11036 chatty                  com.example.camera4                  I  uid=10072(com.example.camera4) RenderThread identical 1 line
2022-12-23 10:49:20.885 11010-11036 <no-tag>                com.example.camera4                  D  set stream to NULL
2022-12-23 10:49:20.894 11010-11064 NetworkSecurityConfig   com.example.camera4                  D  No Network Security Config specified, using platform default
2022-12-23 10:49:20.937 11010-11019 System                  com.example.camera4                  W  A resource failed to call release.
2022-12-23 10:49:20.975 11010-11019 System                  com.example.camera4                  W  A resource failed to call release.
2022-12-23 10:49:20.976 11010-11019 System                  com.example.camera4                  W  A resource failed to call close.
2022-12-23 10:49:22.292 11010-11010 Volley response         com.example.camera4                  D  {"status":200,"body":"https:\/\/b2b-partnerapp-images.s3.ap-south-1.amazonaws.com\/itemweightdetails\/66955be7-47ec-4820-8cc9-0ac64fcebd8b.jpeg","isBase64Encoded":true}
2022-12-23 10:49:24.031 11010-11036 libEGL                  com.example.camera4                  W  EGLNativeWindowType 0x7995738010 disconnect failed


来源: stackexchange

问:
Rider IDE huge usage logo

Does anyone know if this is a bug or something? I've tried to google it but can't find a solution. And is it impossible to turn off top-level statements in c# rider?

ContentLicense: CC BY-SA 4.0

Title: Rider IDE huge usage logo


问:
Keycloak SSO Session Idle timeout does not trigger while user session is idle for that configured time
Our application is created by  Jhipster which comprise with spring boot and keycloak and postgress db. I have set the "SSO Session Idle" time as 1 minute in the keycloak realm settings.

Expectation is keycloak should send logout event if the user is idle for 1 minute and more. But nothing is happening(even no log in keycloak) and the session is still alive. I am able to call other rest API without any issue.

While logging in through key cloak I am able to see following log  in keycloak. Not sure whether this is creating problem.

```<code>03:57:20,717 WARN  [org.keycloak.events] (default task-64) type=REFRESH_TOKEN_ERROR, realmId=google, clientId=youtube, userId=8299cea8-8ebf-45df-8685-b37445620255, ipAddress=10.198.140.148, error=invalid_token, grant_type=refresh_token, refresh_token_type=Offline, refresh_token_id=2b031b6d-5ff4-4967-a300-42b930dfc04b, client_auth_method=client-secret

</code>```

Is there anything specific I have to configure in application.yaml or application_prod.yaml for getting session expired event in spring boot Jhipster application ?

I am struck for many days. Any help would be much appreciated.

I am expecting while setting session idle  time in keycloak, keycloak should send session time out or logout event. And Jhipster spring boot application should able to log out.

Body:
Our application is created by  Jhipster which comprise with spring boot and keycloak and postgress db. I have set the "SSO Session Idle" time as 1 minute in the keycloak realm settings.

Expectation is keycloak should send logout event if the user is idle for 1 minute and more. But nothing is happening(even no log in keycloak) and the session is still alive. I am able to call other rest API without any issue.

While logging in through key cloak I am able to see following log  in keycloak. Not sure whether this is creating problem.

03:57:20,717 WARN  [org.keycloak.events] (default task-64) type=REFRESH_TOKEN_ERROR, realmId=google, clientId=youtube, userId=8299cea8-8ebf-45df-8685-b37445620255, ipAddress=10.198.140.148, error=invalid_token, grant_type=refresh_token, refresh_token_type=Offline, refresh_token_id=2b031b6d-5ff4-4967-a300-42b930dfc04b, client_auth_method=client-secret

Is there anything specific I have to configure in application.yaml or application_prod.yaml for getting session expired event in spring boot Jhipster application ?

I am struck for many days. Any help would be much appreciated.

I am expecting while setting session idle  time in keycloak, keycloak should send session time out or logout event. And Jhipster spring boot application should able to log out.


问:
Error in `annotate()`: ! Can't find geom called "table" Traceback:
I am trying to include table in the survival plot. but I get an error as

```<code>Error in `annotate()`:
! Can't find geom called "table"
Traceback:

1. annotate(geom = "table", x = 140, y = 0.9, label = list(as.data.frame(table)))
2. layer(geom = geom, params = list(na.rm = na.rm, ...), stat = StatIdentity,
 .     position = PositionIdentity, data = data, mapping = aes_all(names(data)),
 .     inherit.aes = FALSE, show.legend = FALSE)
3. check_subclass(geom, "Geom", env = parent.frame(), call = call_env)
4. cli::cli_abort("Can't find {argname} called {.val {x}}", call = call)
5. rlang::abort(message, ..., call = call, use_cli_format = TRUE,
 .     .frame = .frame)
6. signal_abort(cnd, .file)
</code>```

The code I executed is:

```<code>library(survival)
library(survminer)

data(aml)
aml$x <- as.character(aml$x)
aml[10,3] <- 'SuperMaintained'
aml[11,3] <- 'SuperMaintained'
aml[22,3] <- 'SuperMaintained'
aml[23,3] <- 'SuperMaintained'
aml$x <- factor(aml$x, levels = c('Nonmaintained','Maintained','SuperMaintained'))

fit <- survfit(Surv(time, status) ~ x, data = aml)

res=pairwise_survdiff(Surv(time, status) ~ x, data = aml)
table <- res$p.value

p1 <- ggsurvplot(fit, conf.int = FALSE, surv.median.line = c('hv'), data = aml,  pval = TRUE, risk.table = FALSE)

p1$plot + annotate(geom = "table", x = 140, y = 0.9, label = list(as.data.frame(table)))
</code>```

Body:
I am trying to include table in the survival plot. but I get an error as

Error in `annotate()`:
! Can't find geom called "table"
Traceback:

1. annotate(geom = "table", x = 140, y = 0.9, label = list(as.data.frame(table)))
2. layer(geom = geom, params = list(na.rm = na.rm, ...), stat = StatIdentity,
 .     position = PositionIdentity, data = data, mapping = aes_all(names(data)),
 .     inherit.aes = FALSE, show.legend = FALSE)
3. check_subclass(geom, "Geom", env = parent.frame(), call = call_env)
4. cli::cli_abort("Can't find {argname} called {.val {x}}", call = call)
5. rlang::abort(message, ..., call = call, use_cli_format = TRUE,
 .     .frame = .frame)
6. signal_abort(cnd, .file)

The code I executed is:

library(survival)
library(survminer)

data(aml)
aml$x <- as.character(aml$x)
aml[10,3] <- 'SuperMaintained'
aml[11,3] <- 'SuperMaintained'
aml[22,3] <- 'SuperMaintained'
aml[23,3] <- 'SuperMaintained'
aml$x <- factor(aml$x, levels = c('Nonmaintained','Maintained','SuperMaintained'))

fit <- survfit(Surv(time, status) ~ x, data = aml)

res=pairwise_survdiff(Surv(time, status) ~ x, data = aml)
table <- res$p.value

p1 <- ggsurvplot(fit, conf.int = FALSE, surv.median.line = c('hv'), data = aml,  pval = TRUE, risk.table = FALSE)

p1$plot + annotate(geom = "table", x = 140, y = 0.9, label = list(as.data.frame(table)))


问:
How to select an especific span in selenium if every id is different?
I want to select the match odds in the rugby union:
https://www.betfair.com/sport/rugby-union
my code is:

```<code>betodds= driver.find_elements(By.CSS_SELECTOR, 'span.ui-runner-price')
</code>```

However I'm grabbing all the odds match odds, handicap and total points. How can I grab only match odds and not all the others? and every id is different, so I can't select by id.

Body:
I want to select the match odds in the rugby union:
https://www.betfair.com/sport/rugby-union
my code is:

betodds= driver.find_elements(By.CSS_SELECTOR, 'span.ui-runner-price')

However I'm grabbing all the odds match odds, handicap and total points. How can I grab only match odds and not all the others? and every id is different, so I can't select by id.


问:
error: activity not declared in AndroidManifest.xml in Android Studio
My AndroidManifest.xml :

```<code>  <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    android:installLocation="auto">
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

    <uses-feature android:name="com.softbank.hardware.pepper" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.TammyApp">
        <activity android:name=".ui.categories.CategoriesActivity">

        </activity>

#         <activity android:name=".activities.Muse.muse_pick_duration" />

        <activity android:name=".activities.Welcome">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <service android:enabled="true" android:name=".activities.SpeechService" />
    </application>

    </manifest>
</code>```

/////////////////////////////////
muse_pick_duration.kt:

```<code>package com.tammy.tammyapp.activities.Muse

import com.tammy.tammyapp.R
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.tammy.tammyapp.activities.TutorialActivity

abstract class muse_pick_duration : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        setContentView(R.layout.muse_pick_duration)
        super.onCreate(savedInstanceState)

    }
}
</code>```

/////////////////////////////////////////////////////////
museHome.kt:

```<code>package com.tammy.tammyapp.activities.Muse

import android.content.Intent
import android.os.Bundle
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
import com.tammy.tammyapp.R
import com.tammy.tammyapp.activities.TutorialActivity

abstract class MipniHome : AppCompatActivity(){
    //abstract val muse_pick_duration: Unit

    abstract val muse_pick_duration: Unit
    abstract val savedInstanceState: Bundle?

    fun onCreate() {
        setContentView(R.layout.muse_home)
        super.onCreate(savedInstanceState)

        val button3 = findViewById<Button>(R.id.button3)
        button3.setOnClickListener {
            val Intent = Intent(this, muse_pick_duration::class.java)
            startActivity(Intent)
        }
    }
}
</code>```

///////////////////////////////////////////////////////
muse_home.xml:

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    tools:context=".museHome">

    // main menu button
    <Button
        android:id="@+id/button"
        android:layout_width="100dp"
        android:layout_height="60dp"
        android:layout_marginStart="32dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="121dp"
        android:layout_marginBottom="259dp"
        android:backgroundTint="#3F51B5"
        android:text="Main Menu"
        android:textSize="16sp"
        app:cornerRadius="10dp"
        app:layout_constraintBottom_toTopOf="@+id/button2"
        app:layout_constraintEnd_toStartOf="@+id/textView4"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0" />

    // back button
    <Button
        android:id="@+id/button2"
        android:layout_width="100dp"
        android:layout_height="60dp"
        android:layout_marginStart="16dp"
        android:layout_marginBottom="16dp"
        android:backgroundTint="#3F51B5"
        android:text="Back"
        android:textSize="16sp"
        app:cornerRadius="10dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

    // next button
    <Button
        android:id="@+id/button3"
        android:layout_width="100dp"
        android:layout_height="60dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="16dp"
        android:layout_marginBottom="16dp"
        android:backgroundTint="#3F51B5"
        android:text="Next"
        android:textSize="16sp"
        app:cornerRadius="10dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toEndOf="@+id/textView3"
        app:layout_constraintTop_toBottomOf="@+id/imageView"
        app:layout_constraintVertical_bias="1.0" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="216dp"
        android:layout_height="56dp"
        android:layout_marginStart="12dp"
        android:layout_marginBottom="16dp"
        android:text="Press "BACK" to return to the previous screen"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toEndOf="@+id/button2" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="218dp"
        android:layout_height="47dp"
        android:layout_marginEnd="124dp"
        android:layout_marginBottom="24dp"
        android:text="Press "NEXT" when you are ready to continue"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="508dp"
        android:layout_height="63dp"
        android:layout_marginTop="80dp"
        android:layout_marginEnd="237dp"
        android:layout_marginBottom="266dp"
        android:text="Welcome to MIPNI,"
        android:textAlignment="center"
        android:textColor="#000000"
        android:textSize="50sp"
        app:layout_constraintBottom_toTopOf="@+id/textView2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/button"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0" />

    <TextView
        android:id="@+id/textView5"
        android:layout_width="370dp"
        android:layout_height="28dp"
        android:text="your musical companion app!"
        android:textAlignment="center"
        android:textColor="#000000"
        android:textSize="20sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView4" />

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="502dp"
        android:layout_height="256dp"
        android:layout_marginBottom="23dp"
        app:layout_constraintBottom_toTopOf="@+id/textView3"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.501"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView5"
        app:layout_constraintVertical_bias="0.0"
        app:srcCompat="@drawable/music" />

</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

//////////////////////////////////////////////

I attached my code above that includes a button(button3) trying to open another activity(muse_pick_duration) and the AndroidManifest.xml.

The bolded activity is the one that says is not declared but I did declare it... IDK what is going on. Can someone please help?!

I tried so invalidating the cache and restaring. I also tried syncing project with gradle files but mone of that worked. I have two activities: muse_pick_duration and museHome and both are in kotlin...

Body:
My AndroidManifest.xml :

  <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    android:installLocation="auto">
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

    <uses-feature android:name="com.softbank.hardware.pepper" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.TammyApp">
        <activity android:name=".ui.categories.CategoriesActivity">

        </activity>

#         <activity android:name=".activities.Muse.muse_pick_duration" />

        <activity android:name=".activities.Welcome">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <service android:enabled="true" android:name=".activities.SpeechService" />
    </application>

    </manifest>

/////////////////////////////////
muse_pick_duration.kt:

package com.tammy.tammyapp.activities.Muse

import com.tammy.tammyapp.R
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.tammy.tammyapp.activities.TutorialActivity

abstract class muse_pick_duration : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        setContentView(R.layout.muse_pick_duration)
        super.onCreate(savedInstanceState)

    }
}

/////////////////////////////////////////////////////////
museHome.kt:

package com.tammy.tammyapp.activities.Muse

import android.content.Intent
import android.os.Bundle
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
import com.tammy.tammyapp.R
import com.tammy.tammyapp.activities.TutorialActivity

abstract class MipniHome : AppCompatActivity(){
    //abstract val muse_pick_duration: Unit

    abstract val muse_pick_duration: Unit
    abstract val savedInstanceState: Bundle?

    fun onCreate() {
        setContentView(R.layout.muse_home)
        super.onCreate(savedInstanceState)

        val button3 = findViewById<Button>(R.id.button3)
        button3.setOnClickListener {
            val Intent = Intent(this, muse_pick_duration::class.java)
            startActivity(Intent)
        }
    }
}

///////////////////////////////////////////////////////
muse_home.xml:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    tools:context=".museHome">

    // main menu button
    <Button
        android:id="@+id/button"
        android:layout_width="100dp"
        android:layout_height="60dp"
        android:layout_marginStart="32dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="121dp"
        android:layout_marginBottom="259dp"
        android:backgroundTint="#3F51B5"
        android:text="Main Menu"
        android:textSize="16sp"
        app:cornerRadius="10dp"
        app:layout_constraintBottom_toTopOf="@+id/button2"
        app:layout_constraintEnd_toStartOf="@+id/textView4"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0" />

    // back button
    <Button
        android:id="@+id/button2"
        android:layout_width="100dp"
        android:layout_height="60dp"
        android:layout_marginStart="16dp"
        android:layout_marginBottom="16dp"
        android:backgroundTint="#3F51B5"
        android:text="Back"
        android:textSize="16sp"
        app:cornerRadius="10dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

    // next button
    <Button
        android:id="@+id/button3"
        android:layout_width="100dp"
        android:layout_height="60dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="16dp"
        android:layout_marginBottom="16dp"
        android:backgroundTint="#3F51B5"
        android:text="Next"
        android:textSize="16sp"
        app:cornerRadius="10dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toEndOf="@+id/textView3"
        app:layout_constraintTop_toBottomOf="@+id/imageView"
        app:layout_constraintVertical_bias="1.0" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="216dp"
        android:layout_height="56dp"
        android:layout_marginStart="12dp"
        android:layout_marginBottom="16dp"
        android:text="Press "BACK" to return to the previous screen"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toEndOf="@+id/button2" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="218dp"
        android:layout_height="47dp"
        android:layout_marginEnd="124dp"
        android:layout_marginBottom="24dp"
        android:text="Press "NEXT" when you are ready to continue"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="508dp"
        android:layout_height="63dp"
        android:layout_marginTop="80dp"
        android:layout_marginEnd="237dp"
        android:layout_marginBottom="266dp"
        android:text="Welcome to MIPNI,"
        android:textAlignment="center"
        android:textColor="#000000"
        android:textSize="50sp"
        app:layout_constraintBottom_toTopOf="@+id/textView2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/button"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0" />

    <TextView
        android:id="@+id/textView5"
        android:layout_width="370dp"
        android:layout_height="28dp"
        android:text="your musical companion app!"
        android:textAlignment="center"
        android:textColor="#000000"
        android:textSize="20sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView4" />

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="502dp"
        android:layout_height="256dp"
        android:layout_marginBottom="23dp"
        app:layout_constraintBottom_toTopOf="@+id/textView3"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.501"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView5"
        app:layout_constraintVertical_bias="0.0"
        app:srcCompat="@drawable/music" />

</androidx.constraintlayout.widget.ConstraintLayout>

//////////////////////////////////////////////

I attached my code above that includes a button(button3) trying to open another activity(muse_pick_duration) and the AndroidManifest.xml.

The bolded activity is the one that says is not declared but I did declare it... IDK what is going on. Can someone please help?!

I tried so invalidating the cache and restaring. I also tried syncing project with gradle files but mone of that worked. I have two activities: muse_pick_duration and museHome and both are in kotlin...


问:
pandas_webreader 0.10 ValueError error 2022

book = web.get_iex_book('AAPL')

error:

```<code>Output exceeds the size limit. Open the full output data in a text editor
---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
d:\anaconda3\envs\tensorflow\lib\site-packages\pandas_datareader\iex\__init__.py in _output_error(self, out)
     72         try:
---> 73             content = json.loads(out.text)
     74         except Exception:

d:\anaconda3\envs\tensorflow\lib\json\__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    345             parse_constant is None and object_pairs_hook is None and not kw):
--> 346         return _default_decoder.decode(s)
    347     if cls is None:

d:\anaconda3\envs\tensorflow\lib\json\decoder.py in decode(self, s, _w)
    336         """
--> 337         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338         end = _w(s, end).end()

d:\anaconda3\envs\tensorflow\lib\json\decoder.py in raw_decode(self, s, idx)
    354         except StopIteration as err:
--> 355             raise JSONDecodeError("Expecting value", s, err.value) from None
    356         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:
...
---> 75             raise TypeError("Failed to interpret response as JSON.")
     76
     77         for key, string in content.items():

TypeError: Failed to interpret response as JSON.
</code>```

the second problem  is   :

```<code>start = datetime(2010, 1, 1)

end = datetime(2013, 1, 27)

gdp = web.DataReader('GDP', 'fred', start, end)

gdp.info()
</code>```
```<code>Exception in thread Thread-18 (_run_via_pool):
Traceback (most recent call last):
  File "d:\anaconda3\envs\tensorflow\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "d:\anaconda3\envs\tensorflow\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "d:\anaconda3\envs\tensorflow\lib\site-packages\multitasking\__init__.py", line 102, in _run_via_pool
    return callee(*args, **kwargs)
  File "d:\anaconda3\envs\tensorflow\lib\site-packages\yfinance\multi.py", line 188, in _download_one_threaded
    data = _download_one(ticker, start, end, auto_adjust, back_adjust,
  File "d:\anaconda3\envs\tensorflow\lib\site-packages\yfinance\multi.py", line 202, in _download_one
    return Ticker(ticker).history(period=period, interval=interval,
  File "d:\anaconda3\envs\tensorflow\lib\site-packages\yfinance\base.py", line 166, in history
    _time.strptime(str(start), '%Y-%m-%d')))
  File "d:\anaconda3\envs\tensorflow\lib\_strptime.py", line 562, in _strptime_time
    tt = _strptime(data_string, format)[0]
  File "d:\anaconda3\envs\tensorflow\lib\_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data 'fred' does not match format '%Y-%m-%d'
</code>```

how to fix it ?? is it coused by the verision???
but all i refer to the documnent.
https://pydata.github.io/pandas-datareader/remote_data.html?highlight=get_iex_book#fred

in fact every code i run is wrong  what the matter with my pandas-datareader?????????

Body:
book = web.get_iex_book('AAPL')

error:

Output exceeds the size limit. Open the full output data in a text editor
---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
d:\anaconda3\envs\tensorflow\lib\site-packages\pandas_datareader\iex\__init__.py in _output_error(self, out)
     72         try:
---> 73             content = json.loads(out.text)
     74         except Exception:

d:\anaconda3\envs\tensorflow\lib\json\__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    345             parse_constant is None and object_pairs_hook is None and not kw):
--> 346         return _default_decoder.decode(s)
    347     if cls is None:

d:\anaconda3\envs\tensorflow\lib\json\decoder.py in decode(self, s, _w)
    336         """
--> 337         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338         end = _w(s, end).end()

d:\anaconda3\envs\tensorflow\lib\json\decoder.py in raw_decode(self, s, idx)
    354         except StopIteration as err:
--> 355             raise JSONDecodeError("Expecting value", s, err.value) from None
    356         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:
...
---> 75             raise TypeError("Failed to interpret response as JSON.")
     76
     77         for key, string in content.items():

TypeError: Failed to interpret response as JSON.

the second problem  is   :

start = datetime(2010, 1, 1)

end = datetime(2013, 1, 27)

gdp = web.DataReader('GDP', 'fred', start, end)

gdp.info()

Exception in thread Thread-18 (_run_via_pool):
Traceback (most recent call last):
  File "d:\anaconda3\envs\tensorflow\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "d:\anaconda3\envs\tensorflow\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "d:\anaconda3\envs\tensorflow\lib\site-packages\multitasking\__init__.py", line 102, in _run_via_pool
    return callee(*args, **kwargs)
  File "d:\anaconda3\envs\tensorflow\lib\site-packages\yfinance\multi.py", line 188, in _download_one_threaded
    data = _download_one(ticker, start, end, auto_adjust, back_adjust,
  File "d:\anaconda3\envs\tensorflow\lib\site-packages\yfinance\multi.py", line 202, in _download_one
    return Ticker(ticker).history(period=period, interval=interval,
  File "d:\anaconda3\envs\tensorflow\lib\site-packages\yfinance\base.py", line 166, in history
    _time.strptime(str(start), '%Y-%m-%d')))
  File "d:\anaconda3\envs\tensorflow\lib\_strptime.py", line 562, in _strptime_time
    tt = _strptime(data_string, format)[0]
  File "d:\anaconda3\envs\tensorflow\lib\_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data 'fred' does not match format '%Y-%m-%d'

how to fix it ?? is it coused by the verision???
but all i refer to the documnent.
https://pydata.github.io/pandas-datareader/remote_data.html?highlight=get_iex_book#fred

in fact every code i run is wrong  what the matter with my pandas-datareader?????????


问:
How to output my files to the host machine on docker
Im new, very new to this whole docker thing and also programming thing.

I built a simple script that outputs a series of files (namely a .tsv and a .txt) from an api.

Now, this works fine running the script on the regular linux terminal (I know, thats not the same thing).

However, with docker, it never seems to output my file to my host machine.

Interesting thing is, when running 'ls' in the docker terminal, all the files show up!

```<code>sudo docker run -it -v /home/USER/DESKTOP/PROJECT:/CONTAINERWORKINGDIR IMAGENAME
</code>```

also, tried mounting it via the dockerfile, which also seems to not do anything.

I don't get an error, the host path is just empty, always...

running 'ls' will show my files, sitting neatly in the docker directory, but when verifying on the host path, its empty. Also, verified that all the files are accessible.

Docker File:

```<code># Use an official Python runtime as a base image
FROM python:3.11.1-alpine

# Set the working directory to /AudiblePy
WORKDIR /AudiblePy

# Copy the current directory contents into the container at /AudiblePy
COPY main.py /AudiblePy
COPY additional.py /AudiblePy
COPY requirements.txt /AudiblePy

# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt

# Run app.py when the container launches
CMD ["python", "main.py"]
</code>```

Would love some help, Im stumped and it seems that I can't find any information on why this is...

Body:
Im new, very new to this whole docker thing and also programming thing.

I built a simple script that outputs a series of files (namely a .tsv and a .txt) from an api.

Now, this works fine running the script on the regular linux terminal (I know, thats not the same thing).

However, with docker, it never seems to output my file to my host machine.

Interesting thing is, when running 'ls' in the docker terminal, all the files show up!

sudo docker run -it -v /home/USER/DESKTOP/PROJECT:/CONTAINERWORKINGDIR IMAGENAME

also, tried mounting it via the dockerfile, which also seems to not do anything.

I don't get an error, the host path is just empty, always...

running 'ls' will show my files, sitting neatly in the docker directory, but when verifying on the host path, its empty. Also, verified that all the files are accessible.

Docker File:

# Use an official Python runtime as a base image
FROM python:3.11.1-alpine

# Set the working directory to /AudiblePy
WORKDIR /AudiblePy

# Copy the current directory contents into the container at /AudiblePy
COPY main.py /AudiblePy
COPY additional.py /AudiblePy
COPY requirements.txt /AudiblePy

# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt

# Run app.py when the container launches
CMD ["python", "main.py"]

Would love some help, Im stumped and it seems that I can't find any information on why this is...


问:
An uncaught Exception was encountered Type: Error Message: Class 'BaseController' not found
```<code><?php
defined('BASEPATH') or exit('No direct script access allowed');

class index extends BaseController
{

    public function __construct()
    {
        parent::__construct();
        $this->load->model('P_pmb', 'p_pmb');
    }

    public function index()
    {
        $data['title'] = 'Dashboard';
        $this->render('index/index', $data);
    }

    public function pendaftarprodi1()
    {
        $data['title'] = 'Grafik Berdasarkan Prodi 1';
        $prodi = $this->p_pmb->listProdi();
        foreach ($prodi as $key => $p) {
            $prodi[$key]['jumlah'] = $this->p_pmb->jumlahPendaftarProdi1($p['id_prodi']);
            $prodi[$key]['jumlah2'] = $this->p_pmb->jumlahPendaftarProdi2($p['id_prodi']);
            $prodi[$key]['size'] = rand(10, 30);
        }

        //grafik 1
        $result = null;
        foreach ($prodi as $p => $prod) {
            // if ($prod['jumlah'] > $sum) {
            //     $sum = $prod['jumlah'];
            //     $sliced = true;
            //     $selected = true;
            // }
            $result[$p] = [
                "name"  => $prod['nama_prodi'],
                "jumlah" => $prod['jumlah'],
                "y"     => $prod['size'],
                // "sliced" => $sliced,
                // 'selected' => $selected
            ];
        }

        $data['pendaftar'] = $prodi;
        $data['grafik1'] = json_encode($result);
        $this->render('index/grafik1', $data);
    }

    public function pendaftarprodi2()
    {
        $data['title'] = 'Grafik Berdasarkan Prodi 2';
        $prodi = $this->p_pmb->listProdi();
        foreach ($prodi as $key => $p) {
            $prodi[$key]['jumlah'] = $this->p_pmb->jumlahPendaftarProdi1($p['id_prodi']);
            $prodi[$key]['jumlah2'] = $this->p_pmb->jumlahPendaftarProdi2($p['id_prodi']);
            $prodi[$key]['size'] = rand(10, 30);
        }

        //grafik 2
        $hasil = null;
        foreach ($prodi as $p => $prod) {
            $hasil[$p] = [
                "name"  => $prod['nama_prodi'],
                "jumlah" => $prod['jumlah2'],
                "y"     => $prod['size'],
                // "sliced" => $sliced,
                // 'selected' => $selected
            ];
        }

        $data['pendaftar'] = $prodi;
        $data['grafik2'] = json_encode($hasil);
        $this->render('index/grafik2', $data);
    }
    public function pendaftarprestasi()
    {

        $pendaftarprestasi = $this->p_pmb->listpendaftarprestasi();
        foreach ($pendaftarprestasi as $key => $p) {
            $pendaftarprestasi[$key]['jumlah'] = $this->p_pmb->jumlahpendaftarprestasi($p['tingkat_prestasi']);
            $pendaftarprestasi[$key]['size'] = rand(10, 30);
        }

        $result = null;
        $sum = 0;
        foreach ($pendaftarprestasi as $p => $pendpres) {
            //if ($pendpres['jumlah'] > $sum) {
            //   $sum = $pendpres['jumlah'];
            //  $sliced = true;
            //  $selected = true;
            // }
            $result[$p] = [
                "name"  => $pendpres['tingkat_prestasi'],
                'jumlah' => $pendpres['jumlah'],
                'y'     => $pendpres['size'],
                //    $sliced => $sliced,
                //   $selected => $selected
            ];
        }

        $data['pendaftarprestasi'] = $pendaftarprestasi;
        $data['grafikprestasi'] = json_encode($result);
        $this->render('index/grafikprestasi', $data);
    }
    public function jalurmasuk()
    {

        $pendaftar = $this->p_pmb->listjalurpendaftar();
        foreach ($pendaftar as $key => $p) {
            $pendaftar[$key]['jumlah'] = $this->p_pmb->jumlahjalurpendaftar($p['nama_jalur']);
            $pendaftar[$key]['jumlah'] = rand(10, 30);
        }

        $result = null;
        $sum = 0;
        foreach ($pendaftar as $p => $jalmask) {
            //if ($jalmask['jumlah'] > $sum) {
            //   $sum = $jalmask['jumlah'];
            //  $sliced = true;
            //  $selected = true;
            // }
            $result[$p] = [
                "name"  => $jalmask['nama_jalur'],
                'jumlah' => $jalmask['jumlah'],
                'y'     => $jalmask['jumlah'],
                //    $sliced => $sliced,
                //   $selected => $selected
            ];
        }

        $data['jalur_masuk'] = $jalmask;
        $data['grafikmasuk'] = json_encode($result);
        $this->render('index/grafikmasuk', $data);
    }
    public function pendapatan()
    {
        $data['title'] = 'Grafik Pendapatan Berdasarkan Bank';
        $bank = $this->p_pmb->listBank();
        $pendaftar = $this->p_pmb->pendaftarBank();

        $categories = null;
        $lunas = null;
        $belum_lunas = null;
        $sumTotal = 0;
        foreach ($bank as $i => $b) {
            $categories[] = $b['bank'];
            foreach ($pendaftar as $key => $value) {
                if ($b['id_bank'] == $value['id_bank']) {
                    if ($value['is_bayar'] == '1') {
                        $sumTotal += intval($value['total']);
                        $lunas[] = intval($value['total']);
                    } else {
                        $belum_lunas[] = intval($value['total']);
                    }
                }
            }
        }

        $result[] = [
            'name' => 'Pendapatan',
            'data' => $lunas,
        ];
        $data['subtitle'] = 'Total Pendapatan Rp.' . $sumTotal;
        $grafik['id_bank'] = json_encode($result);
        $grafik['categories'] = json_encode($categories);
        $data['grafikpendapatan'] = $grafik;
        $this->render('index/grafikpendapatan', $data);
    }
    public function bank()
    {
        $data['title'] = 'Grafik Pendapatan Berdasarkan Bank';
        $bank = $this->p_pmb->listBank();
        $pendaftar = $this->p_pmb->pendaftarBank();

        $categories = null;
        $lunas = null;
        $belum_lunas = null;
        $sumTotal = 0;
        foreach ($bank as $i => $b) {
            $categories[] = $b['bank'];
            foreach ($pendaftar as $key => $value) {
                if ($b['id_bank'] == $value['id_bank']) {
                    if ($value['is_bayar'] == '1') {
                        $sumTotal += intval($value['total']);
                        $lunas[] = intval($value['total']);
                    } else {
                        $sumTotal += $value['jumlah'];
                        $belum_lunas[] = intval($value['total']);
                    }
                }
            }
        }

        $result[] = [
            'name' => 'Lunas',
            'data' => $lunas,
        ];
        $result[] = [
            'name' => 'Belum Lunas',
            'data' => $belum_lunas,
        ];
        $data['subtitle'] = 'Total Pendaftar: ' . $sumTotal;
        $data['id_bank'] = $bank;
        $data['grafikbank'] = json_encode($result);
       $this->render('index/grafikbank', $data);
    }
}

<?php
defined('BASEPATH') or exit('No direct script access allowed');

class BaseController extends CI_Controller
{

    public function render($filename, $data)
    {
        $this->load->view('template/app_top', $data);
        $this->load->view('template/template_scripts', $data);
        $this->load->view($filename, $data);
        $this->load->view('template/app_bottom', $data);
    }
}
</code>```