I am working with Camera2 API. I have the camera preview in a texture view. And an Image that is placed over the texture view. The imageView and the textureView are placed in a RelativeLayout.
Getting the rootView and converting it into Bitmap gets me only a black-screen in the texture view as follows inside a Relative Layout:
View rootView = findViewById(android.R.id.content).getRootView();
rootView.setDrawingCacheEnabled(true);
return rootView.getDrawingCache();
The method getBitmap() returns the bitmap of the texture view successfully but id doesn't include the imageView which is overlaid on it.
How can I get the Bitmap of the textureView with the image overlaid on it?
Already referred Links:
Android: Want to put an silhouette overlay on a Camera preview
How can i place dynamic image view over texture view?
My Layout Structure is as follows:
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextureView
android:id="@+id/textureView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/SelectedImage"
android:layout_width="140dp"
android:layout_height="140dp" />
</FrameLayout>