'How can I take screen shots from running video in Android

I have developed an application in android which contains videos. Now I want to take screen shots from that running video. Is anybody having any idea regarding this thing.

Pleas provide some example code or links.



Solution 1:[1]

What you need is using MediaPlayer. Put SurfaceView to your layout and provide it to the MediaPlayer. After the playback is begun you will be able to get snapshot from SurfaceView.

Solution 2:[2]

If you want to take the screenshot of your full screen (with status bar and all) you cannot do that programatically unless you have a rooted phone. If you want the screenshot of your app only, then you can. If you don't want it programatically, then you can-

Go to "Devices" view in eclipse and you have a screenshot (camera like) button there. You can find it from from Window -> Show View.

Solution 3:[3]

Solution 4:[4]

Assume your video view is inside a linearlayout, you can try:

            linearlayout.setDrawingCacheEnabled(true);
            linearlayout.buildDrawingCache();
            Bitmap bm = linearlayout.getDrawingCache();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vladimir Ivanov
Solution 2 Avadhani Y
Solution 3 Community
Solution 4 Calvin