How to take screenshot in android emulator
Asked Answered
L

10

48

From Android 4.0, it supports volumn down+power key to take screenshot and saved in gallery. But how to do this in android emulator.

I know in eclipse, there is a 'take screenshot' button, but this is not what I want. I need it in the emulator and saved in emulator.

Logomachy answered 9/4, 2013 at 2:31 Comment(5)
I don't think that there is an other way to do it. (At least I did not come off an other way.)Venuti
Do you want to take it Programmatically?Sousaphone
No... what i am doing is, add an app option to process the screenshot for the share intent after taking screenshot. I want to test it in emulator.Logomachy
possible duplicate of How to take emulator screenshots using Eclipse?Reeva
This works fine if you are using Android Studio 2.0 or above: https://mcmap.net/q/109574/-taking-screenshot-on-emulator-from-android-studioSharpedged
S
76

As seen in this post: Screenshot of the Nexus One from adb?, you can also take a screenshot using adb:

 adb shell /system/bin/screencap -p /sdcard/screenshot.png
 adb pull /sdcard/screenshot.png screenshot.png
Scandalize answered 1/3, 2014 at 11:50 Comment(6)
nice. I also found a one liner: adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.pngGalloromance
In the emulator, the resulting png is 0 bytes.. Any other way around this?Herrle
Note that this won't work if you enable the option "Use Host GPU". The screenshot will be an empty png (0 byte). Turn of "Use Host GPU" and it will work OK, although the emulator will be terribly slow (and might not even start with large screen sizes).Directions
Had to work a bit to find a writable directory, using some adb shell ls -l did help there - then this worked great.Robinia
Found another one liner workaround hereSystematism
a longer 'oneliner' for saving a timestamped screenshot to the current dir: fname="screenshot-date +%Y-%m-%d-_%H_%M_%S.png" && adb shell /system/bin/screencap -p "/sdcard/$fname" && adb pull "/sdcard/$fname" . (make sure to include the final dot)Logo
D
75

just click in photo icon for take screenshot in android emulator

enter image description here

Dermatosis answered 21/12, 2015 at 15:34 Comment(2)
Does not work. Android Emulator does not look anything like that and does not have that button.Copulate
@Dermatosis OP specified "I need it in the emulator and saved in emulator" how do you save the image in the emulator with this method?Appositive
G
18

In new emulator you can do it by pushing camera icon. By default it saved in desktop.

enter image description here

Gringo answered 6/1, 2020 at 15:42 Comment(1)
This fails to answer the original request: "I need it in the emulator and saved in emulator." This solution will save the screenshot to your desktop, not the emulator.Cross
B
7

Window > Show View > Other. In the newly opened dialog box, under Android category, select Devices.

Now on the Devices panel, Click the button as shown in the Image and your screenshot is ready.

Bollinger answered 7/10, 2013 at 13:55 Comment(1)
As shown in what image? I found the icon, but it's not clear from the answer where it is.Fascine
S
6

Long Press on Power button from the left side menu. then you will have the option for the screenshot. enter image description here

Schlessel answered 18/3, 2020 at 9:38 Comment(1)
This is the appropriate solution on Android versions that support it. Older versions may only give you "Power Off" and "Restart" options.Cross
P
5

You can use ddms which has option to take screen shot. On DDMS -> Select Device -> Select Screen Capture

Edit AFIK its not possible but this scenario will solely depend emulator image. Device hotkey might work on some OS images. Try same key combination from emulator link.

If your emulator uses factory or same images then it should be possible. You can download factory images for your emulator. see available nexus images from this link also it is possible to download images from manufacturer site.

Alternatively you can take screen shot following way,

View content = findViewById(R.id.myView);
content.setDrawingCacheEnabled(true);
Bitmap bitmap = content.getDrawingCache();

And later save this anywhere you like. This is not optimal solution and it will only print what you have inside your view.

Phoebe answered 9/4, 2013 at 2:43 Comment(2)
Specifically said that this was not a solution.Caylacaylor
I don't think this works. I want to take screenshot inside the emulator, so that I can share to other app directly.Logomachy
A
4

You can take a screenshot if you open the Android view "devices" (under Window --> Show View --> Other... --> Android --> Devices). Click on the device or emulator you want to take a screen shot of, then click the "Screen Capture" button (it looks like a little picture, and it should be next to a stop sign button). Occasionally the device won't immediately load the picture; sometimes you have to close/reopen the screen capture window.

This is equivalent to taking a picture via DDMS, but you can do it in Eclipse instead of opening another application.

Appall answered 5/1, 2014 at 16:35 Comment(0)
E
1
#!/bin/bash -f
while : ; do

echo "press the number of the screenshot to capture";

read i

adb shell /system/bin/screencap -p /sdcard/screenshot.png
adb pull /sdcard/screenshot.png "${i}.png"

done

ctrl-c
Excurved answered 4/9, 2020 at 18:29 Comment(0)
K
0

You can simply press the shortcut key i.e. ctlr + S to take screenshot in the emulator.

Also there is a button given on the emulator to take the screenshot.

Simply press this button button and you'll have a screenshot of the emulator.

Hope that it helped you.

Kherson answered 8/5, 2021 at 9:26 Comment(1)
This doesn't work on a Mac.Ledda
T
0
  1. Go to your emulator then press:

ctrl + s

to save your screenshot.

hope its work.

Tremayne answered 30/5, 2021 at 7:17 Comment(1)
Doesn't work on Mac.Ledda

© 2022 - 2024 — McMap. All rights reserved.