Projecting Android on the Big Screen

Suppose you need to show off an Android application. Maybe you are making a VC funding pitch, or you are demonstrating for carriers at the upcoming Mobile World Congress, or you are explaining to a government agency how your Android app will simultaneously cure world hunger and keep tabs on area potholes.

The simplest thing to do when presenting Android to a large audience is to use the emulator, connected to a notebook, connected to a projector. This is quick, easy, and you may already have the projector if you do this sort of presentation a lot.

However, there are times when the emulator is insufficient. Perhaps the application needs actual GPS coordinates rather than faked values supplied by DDMS. Perhaps the application needs actual accelerometer movements rather than ones provided by a sensor simulator. Perhaps the application integrates with other applications that are on the device but not on an emulator (e.g., YouTube player).

You could buy or rent a device projector, but even this has issues if you need to be moving the device around (e.g., play an accelerometer-aware game).

Or, you can try DroidEx.

DroidEx extends the live device screen capturing technology built into DDMS and hierarchyviewer. It gives you a window displaying a live 6 fps (frames per second) perspective of the screen contents of an actual Android device. Since most of the work was done by the core Android team with their toolsmithing, DroidEx itself is about ~100 lines of very lightly tested code.

To get it, download the 3K JAR file from:

http://groups.google.com/group/cw-android/web/DroidEx.jar

To run it, you need to put it and the ddmslib.jar from your SDK tools/ folder on the classpath and invoke com.commonsware.droidex.DroidEx, such as:

java -cp DroidEx.jar:/opt/android-sdk-linux_x86-1.0_r2/tools/lib/ddmlib.jar com.commonsware.droidex.DroidEx

It also requires that the adb daemon be running, such as a development PC/Mac.

It assumes there is precisely one device plugged in or emulator running. All it does is open a window showing you the contents of that device’s or emulator’s screen.

It also suffers from the following limitations:

  • The screen-capture logic in Android proper seems to occasionally miss updates for some reason. I’ve seen this with DDMS and hierarchyviewer too, so I’m assuming it’s something in the Android firmware. Hence, sometimes DroidEx will appear to be a movement behind (e.g., you clicked up in a list, and DroidEx still shows the previous one as the selected item)
  • Once, adb or the device seemed to reject DroidEx part-way through a projection session, causing the image to freeze on DroidEx’s window and a bunch of error messages to be logged to stderr. Closing and reopening DroidEx was sufficient to clear up this condition.

Also, this was compiled against 1.0r2’s version of ddmslib.jar, so it may or may not work with other versions of the SDK.

DroidEx is a very quick and dirty hack, to solve a specific problem. It is far from perfect and may have any number of bugs. Eventually, I will clean it up and release it as open source, as there are a number of ways to extend DroidEx to make it even more useful, such as:

  • Doing a better job of packaging, so you don’t have to fuss with the classpath and manually specifying the class name
  • Allowing the frames-per-second rate to be set on the command line
  • Allowing you to specify which device/emulator to project, if there is more than one attached
  • Allowing you to save a session either as a set of still images (e.g., one every X seconds) or as a movie clip
  • Creating a server variant so the live animation can be viewed online

Questions regarding DroidEx should be asked in the CW-Android Google Group, the support area for the CommonsWare line of Android programming books and related bits of stuff.

About author

AndroidGuys
AndroidGuys 4641 posts

Founded on November 5, 2007, we've enjoyed bringing you the latest in Android news and rumors. Updated daily, we strive to deliver reviews, opinions, and updates on all things related to Android.

You might also like

News and Rumors

ONE DAY ONLY: Google Glass available to public today

If you’ve been anxious to get your hands on Google Glass but haven’t been fortunate enough to scoop up an invitation, today’s your lucky day. Literally, today (April 15, 2014) is

Deals & Steals

GOLD BOX DEALS: Save up to 65% on Kingston memory cards, USB drives

Need to pick up a new memory card or USB drive? You’ll definitely want to check out Amazon’s Gold Box Deal for today, April 15. The online retailer is offering

News and Rumors

Canadian pre-orders for Nexus 6 to begin on October 29th

For those north of the border, don’t think Google has forgotten about you when it comes to the Nexus 6. The device will be available for pre-order in Canada on

20 Comments

  1. AndroidTapp.com
    January 30, 15:57 Reply

    This is awesome! Downloading now. I have some uses for device projections. Thanks!

  2. Tyler Onbekend
    February 10, 13:10 Reply

    Great proof of concept. Would love to see this as an average-user-friendly application. Does this require root like all the other screen capture solutions we’ve seen floating around out there?

  3. Mark Murphy
    February 10, 17:49 Reply

    @Tyler:

    No, this does not require root. In fact, there’s no software running on the device itself, beyond the standard stuff that’s already on there. DroidEx uses the same services that DDMS and hierarchyviewer use for their screen images.

    You’ll need the SDK installed on the projecting PC, so you have the adb daemon and such. But otherwise, that should be it.

  4. richard
    April 30, 09:09 Reply

    I am very impressed and looking forward to your code release.

    However, lib/ddmlib.jar seems to be removed from SDK-1.5, so I guess it won’t work any more, right?

    ps. It works at SDK-windows-1.1_r1

  5. Mark Murphy
    April 30, 09:12 Reply

    I have not yet tried DroidEx with 1.5. There may be some changes needed.

  6. klaus
    August 25, 09:50 Reply

    It works for me on 1.5 (on an HTC Magic)…

  7. anton
    September 28, 09:29 Reply

    nice software! i used it to present my software on the viennese localcamp this weekend! i would love to have a zoom feature, could you get me the source-code, so i can implement this little feature?

  8. dethx
    October 09, 23:29 Reply

    It's work on my ubuntu but not in Windows

    java -cp DroidEx.jar:D:Dataandroid-sdk-windows-1.5_r3toolslibddmlib.jar com.commonsware.droidex.DroidEx

    Do I missing something. Thanks for great great software.

  9. devthx
    October 09, 23:33 Reply

    sorry for my fool. Fix it – replace : with ;

    java -cp DroidEx.jar;D:Dataandroid-sdk-windows-1.5_r3toolslibddmlib.jar com.commonsware.droidex.DroidEx

  10. Rick
    March 09, 00:26 Reply

    Has anyone gotten this software to work on Android 2.0 or 2.1?

  11. Cathleen
    September 10, 16:03 Reply

    Works fine with my HTC Tattoo (1.6) but not with Samsung Galaxy S (2.1). I guess it might be the SDK issue…
    Great app anyway.

  12. WRSONG
    October 16, 14:18 Reply

    I’m just a little confuse or not up to task for this. It not friendly for a typical user. Guess I need a step by step or even video of how to do it. Any one want to make pictorial or explain the detail detail?

  13. Stratis
    November 13, 00:21 Reply

    Very cool!

    I wonder if there a parameter to handle landscape mode?

    I guess there wouldn’t be since it’s accelerometer triggered (or device dependent).

  14. Stratis
    November 13, 01:16 Reply

    Also it doesn’t seem to be running at 6FPS for me.

    I count 1-2 frames per second…

  15. Einstein
    March 01, 03:46 Reply

    Kindly somebody tell as to how to make it work for the samsung galaxy series (galaxy tab or galaxy S) :)

    Thanks

Leave a Reply