开发者

Taking screenshot of device's current screen

When one wants to publish his app on the Play Store (previously known as Android Market), he can upload screenshots of his app. I would like to take these screenshots with my current device (Motorola Droid) that I'm using to test the application.

There are some apps on the Play Store that allow you to take screenshots, but you have to root your phone, which I don't want to. There are related topics within Stack Overflow where people want to take screenshots out of there code (here). However I just want to take screenshots of my running app with the current device, which is connected via USB to my computer; I'm developing via Eclipse, so there should be a way to tell your running device that it should take a screenshot via the SDK, right?

Some website (e.g. LifeHacker) mention a way to do this,

To 开发者_运维百科take a screenshot, you'll be required to enable USB Debugging under the settings, install the Android software development kit, and then connect to the phone with a debug tool

but they don't explain what I actually need to do step-by-step.

I would really appreciate if someone can help me out.


Since you probably are a developer, you have SDK and working Eclipse for running Android applications. Just plug in the phone, and make sure you enabled on the Phone the USB Debugging, the device needs to show up in the DDMS perspective of Eclipse.

Once your device shows up in the DDMS perspective there is in icon there to capture the screen.


If you are already using Eclipse to develop your app, then you already have the Android software development kit installed. So, just open the ddms utility that is on the sdk-android/tools directory. There, you can take screenshots by selecting your device and pressing: Ctrl+S (Device -> Screen capture…).

ddms looks like:

Taking screenshot of device's current screen


There's a tool that the Android SDK comes with to help you take screenshots if your device is connected to the computer. I'll explain both. First, for both you need to plug your device into the computer and have it be recognized by adb (aka, when you run "adb devices" it shows your phone).

Then you can either use Eclipse or DDMS:

DDMS

  1. Open ddms.

  2. Click on your device in the list on the left.

  3. Go to the menu Device --> Screen Capture.

Eclipse

  1. Open Eclipse.

  2. Open the "devices" view. You can get to it via Window --> Show View --> Other... --> Android --> Devices.

  3. Click on your device.

  4. In the Devices view, there's a little picture in the upper right corner. If you hover your mouse over it it says "Screen Capture." Click that.

Both methods lead you to the same tool which captures screenshots. Sometimes it can be a little buggy - occasionally I need to close/reopen the window in order to get it to take a screenshot.


Just noting that ddms is deprecated and this function is now available in the monitor tool (tools/monitor) instead.

Open monitor from a console window and select the device in the left panel. Click the camera (Screen Capture) icon above and you'll see the current screen. Then you can rotate if needed and copy or save the image. Refresh will grab a free screen grab in case you are saving multiple shots or didn't get what you wanted the first time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜