RecordingView and link . You can take a snapshot with this code If you have video in your xml, you must make linearLayout your parent (videoView as a child of linearLayout), and when you save the linearlayout image, it means that you will save your video image.
Try this and read this code that I sent to take the picture.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:text="Start" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginRight="16dp" android:text="Pause" /> <ImageView android:layout_width="120dip" android:layout_height="120dip" android:text="Take Screenshot" android:id="@+id/ImageView01" android:layout_centerHorizontal="true" /> <LinearLayout android:orientation="vertical" android:layout_width="500px" android:layout_height="500px" android:id="@+id/LinearLayout01" android:layout_alignLeft="@+id/textView1" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:background="#FF0000" android:layout_marginBottom="34dp"> <SurfaceView android:id="@+id/preview" android:layout_width="400px" android:layout_height="400px" android:layout_gravity="center" /> </LinearLayout> <Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/spinner1" android:layout_marginLeft="20dp" android:layout_marginTop="36dp" android:text="Button" /> </RelativeLayout>
Hope this helps
Add this to Button3 Listner
private Button.OnClickListener myButtonOnClickListener3 = new Button.OnClickListener() { @Override public void onClick(View arg0) {
Change your surface manager and height
<SurfaceView android:id="@+id/preview" android:layout_width="400px" android:layout_height="400px" android:layout_gravity="center" />
and add android:background="#FF0000" to your line layout
this will help you understand if ur snapshot code is working or not
source share