0

When I take the screenshot. The part where there is camera preview goes black.

private fun getScreenShot(view: View): Bitmap {
        val returnedBitmap = Bitmap.createBitmap(view.width, view.height, Bitmap.Config.ARGB_8888)
        PixelCopy.request(window, returnedBitmap, {}, Handler(Looper.getMainLooper()))
        return returnedBitmap
    }

activity_main.xml

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/fragment"
        android:name="com.google.ar.sceneform.ux.ArFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
major
  • 21
  • 1

1 Answers1

0

Change the first parameter in the function

 PixelCopy.request(window, returnedBitmap, {}, Handler(Looper.getMainLooper()))

to

 PixelCopy.request(arFragment.sceneView, returnedBitmap, {}, Handler(Looper.getMainLooper()))
major
  • 21
  • 1