Mark Murphy wrote:
> Well, there's some way to get screen grabs off the device that DDMS
> uses. I don't see an adb command for it, so off the top of my head I'm
> not sure how it's done. But I think the DDMS source code is in the git
> repository.
> 
> In theory, one could use that technique to create a desktop program that
> automatically refreshes an image of the device. I don't know how much
> horsepower the screen-capture stuff takes, which would determine how
> frequently you can refresh the image without slowing the device down too
> much. It also implies you can connect the device to something with the
> mini-USB cable, I imagine.
> 
> It's far from the most elegant solution, but it's something...

I did a pinch more research and am logging some notes here:

DDMS's screen shot dialog is cunningly disguised as
ScreenShotDialog.java. The easiest way to get to it is by visiting:

http://www.google.com/codesearch

and searching for:

ScreenShotDialog package:android

The dialog itself is SWT-dependent, but the guts of the screen-capture
logic appears to be more independent, mostly surrounding the Device and
RawImage classes.

The Swing-based hierarchyviewer also captures screens from the
device/emulator, and it leverages the same Device and RawImage classes.
Pretty much, once you figure out how to get a proper Device object, you
call getScreenshot() and convert the RawImage into a BufferedImage. From
there, it's standard Swing/AWT stuff to display it, such as:

http://www.java-forums.org/awt-swing/6763-how-display-image.html

I haven't hunted around yet to figure out how best to get the proper
Device object, but with two reference uses (DDMS and hierarchyviewer),
it can't be all that tough.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android Training in Sweden -- http://www.sotrium.com/training.php

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to