'setOnPreviewOutputUpdateListener is not provided

I want to display strings in TexView as a result of image analysis. I am using CametaX(androidx.camera:camera-camera2:1.0.0-rc01) for the camera function.

It should be able to update the TextView every image analysis, but it can't access the TextView from the ImageAnalysis.setAnalyzer process.

So, I tried to update the TextView every time the preview is updated.

PreviewConfig pConfig = new PreviewConfig.Builder().build();
  Preview preview = new Preview(pConfig);
  preview.setOnPreviewOutputUpdateListener(
    output -> {
      ((TextView) findViewById(R.id.title)).setText(ResultString[0]);
});

However, setOnPreviewOutputUpdateListener is not provided in the latest CameraX preview.

How can I change the string(TextCiew) displayed on the screen sequentially? Or, it should implement original Lifecycle Class? How?

I've implemented following implementations

    implementation "androidx.camera:camera-camera2:1.0.0-rc01"
    implementation "androidx.camera:camera-lifecycle:1.0.0-rc01"
    implementation "androidx.camera:camera-view:1.0.0-alpha20"

Is it needs any other implementations?

I am using Java, but there are very few Java samples. It would be great if you could show me a concrete solution using Java.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source