1

i working on android application, i tried taking the screenshot of root layout where a text view, video view and relative layout as root view, i'm facing a problem that video is showing as black colored only text view is visible in the screenshot, my goal is to capture root layout along with text on the video clip. please help

<RelativeLayout
    android:id="@+id/root_layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <VideoView
        android:id="@+id/video_player"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
         />

    <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="SAMPLE"
        android:layout_centerInParent="true" />
</RelativeLayout>

My screenshot code:

Capturing the above root layout which id is 'root_layout'

 public static class Screenshot {
    public static Bitmap takescreenshot(View v) {
        v.setDrawingCacheEnabled( true );
        v.buildDrawingCache( true );
        Bitmap b = Bitmap.createBitmap( v.getDrawingCache() );
        v.setDrawingCacheEnabled( false );
        return b;
    }

    public static Bitmap takescreenshotOfRootView(View v) {
        return takescreenshot( v.getRootView() );
    }
}
  • https://stackoverflow.com/questions/27434087/how-to-capture-screenshot-or-video-frame-of-videoview-in-android – ADM Aug 27 '21 at 11:32
  • thanks for your response @ADM,but i have to capture the text also while video is capturing, for example video at the bottom and text above the video, both should should be visible after taking the screenshot – Apptrends media Aug 27 '21 at 11:52
  • Does this answer your question? [How to capture screenshot or video frame of VideoView in Android](https://stackoverflow.com/questions/27434087/how-to-capture-screenshot-or-video-frame-of-videoview-in-android) – Ryan M Aug 29 '21 at 11:24
  • no, @RyanM it doesn't solved my question,mean while i'm able to take screenshot of a frame, but i'm unable to take screenshot of text view which lies above the video view, final screenshot should have a video frame as a background to text view – Apptrends media Aug 31 '21 at 05:28
  • How are you capturing the screenshot currently? – Ryan M Aug 31 '21 at 07:48
  • @RyanM once check the screenshot code – Apptrends media Aug 31 '21 at 09:28

0 Answers0