44

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.

lseeo
  • 729
  • 2
  • 9
  • 14
  • I don't think that there is an other way to do it. (At least I did not come off an other way.) – Ahmad Apr 09 '13 at 02:37
  • Do you want to take it Programmatically? – Shajeel Afzal Apr 09 '13 at 02:57
  • 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. – lseeo Apr 09 '13 at 03:07
  • possible duplicate of [How to take emulator screenshots using Eclipse?](http://stackoverflow.com/questions/2065993/how-to-take-emulator-screenshots-using-eclipse) – Ozair Kafray May 04 '15 at 09:39
  • This works fine if you are using Android Studio 2.0 or above: http://stackoverflow.com/a/35454101/6287190 – Anish Hirlekar Oct 05 '16 at 14:42

9 Answers9

74

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
Community
  • 1
  • 1
Pedro Lopes
  • 2,507
  • 25
  • 34
  • 7
    nice. I also found a one liner: adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png – Radu Simionescu Nov 28 '14 at 19:09
  • In the emulator, the resulting png is 0 bytes.. Any other way around this? – markj Jan 22 '15 at 09:45
  • 1
    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). – Jelle Fresen Feb 03 '15 at 09:58
  • Had to work a bit to find a writable directory, using some adb shell ls -l did help there - then this worked great. – MortenSickel May 20 '15 at 20:05
  • Found another one liner workaround [here](http://blog.shvetsov.com/2013/02/grab-android-screenshot-to-computer-via.html) – Aneesh Jun 11 '15 at 16:01
74

just click in photo icon for take screenshot in android emulator

enter image description here

birigy
  • 902
  • 6
  • 3
13

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

enter image description here

N.M
  • 421
  • 1
  • 8
  • 18
  • 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. – Awnage Mar 06 '21 at 19:05
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.

serv-inc
  • 29,557
  • 9
  • 128
  • 146
Ankur Bhatt
  • 71
  • 1
  • 2
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.

minhaz
  • 4,112
  • 3
  • 29
  • 49
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.

3

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

Hassan Raza
  • 331
  • 3
  • 6
  • This is the appropriate solution on Android versions that support it. Older versions may only give you "Power Off" and "Restart" options. – Awnage Mar 06 '21 at 19:04
0
#!/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
QED
  • 9,439
  • 6
  • 46
  • 82
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.