Saturday, April 24, 2010

[How to] Capture screen on Android phones?

After posting the previous blog post on my two weeks experience with Nexus One, many people asked me for a screen cast of the cool new features available on this gadget. Then, I started digging the options available for capturing the screen instead of just using a digital camera. Is it possible to grab a screenshot of your screen? Can I record a screen cast of the Android based smart phones? The answer is yes but it is not as easy as it is on the other smart phones like iPhone. To take a screen capture on an iPhone, you just have to hold the home button and press the sleep / wake up button. The screenshot of the current screen will get stored on your iPhone. The rest of this post will guide you to take a screenshot of your Android based phones. Screen Capture Taking the screenshot

Screenshot can be taken using a tool named “Dalvik Debug Monitor Service (DDMS)” which comes along with the Android SDK. But, this tool does not allow recording of a screen cast used for demonstrations.

  1. As the name suggests, DDMS requires you to connect your phone to the PC on debug mode. Enable USB debugging on your phone. Settings > Applications > Development > USB debugging.
  2. Download and install the latest Android SDK from here. This comes up with all the tools needed for development and testing of your application.
  3. Once the SDK is installed, go to the location on which the SDK is installed. Go to the folder named “Tools” within the SDK base folder.
  4. Run DDMS by clicking on the DDMS.bat. This will open the debug monitor and your device will be listed there.
  5. Select the device from the list of devices shown. Open the “Device” menu > Screen Capture or use the shortcut ‘Ctrl + S’

Recording the Screen

There are no tools / applications available in the SDK for recording your screen. Fortunately, Mark Murphy of CommonsWare has written a wrapper named “DroidEx” on top of DDMS which captures the screen every 6 secs and renders them as a video stream. Then, you can use any of the desktop screen capturing tools like Camtasia, CamStudio, etc This solution will not work out if you are trying to record a game / video playing on your device.

  1. Download DroidEx library (.jar) from here.
  2. Copy the DroidEx.jar to the folder named “tools/lib” within the Android SDK base folder which you have installed in the previous section.
  3. Execute the command: “java -cp DroidEx.jar;ddmlib.jar com.commonsware.droidex.DroidEx”. Check your Java environment variables if anything fails.
Sample screencast of unlocking the screen on Nexus One

Hoping that Android SDK gets better tools to improve our screen capturing experience.

-- Varun

2 comments:

  1. Apart from Screen Capture, DDMS also provides various tools to developers such as Profiler, File Explorer

    ReplyDelete
  2. @Sree Yeah, it provides set of other functionalities

    ReplyDelete