Open the camera with TextureView and press the home button. When I re-open the app, TextureView still displays the last preview image. I try to Cover preview_frame_root with another View when onstop. Restarting APP will still display the camera preview Image before TextureView
<FrameLayout
android:id="@+id/preview_root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:splitMotionEvents="false">
</FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/cover"
android:visibility="gone"/>
I add View to cover preview_root and hide the view when onrestart (I add some time delay);
But still not work also will show amoment last camera preview imange on TextureView
I think some caching is causing the problem here.
I set used the code onstop or onrestart method :
View cover = findViewById(cover);
cover.setBackgroundColor(Color.BLACK):
cover.setVisibility(VISIBLE);
Cover view will show but also have some delay, so I also look preview_root view. it look like that UI is not update in time
Zhong Yeqing is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.