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:
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