Question

I am using eclipse Indigo for Android Development. This might sound a little crazy , but Is there any feature in eclipse that will automatically take screenshots of every screen while the app is running? Or does this need to be done programatically? Actually what I want is, I need screen shots of all the screens in my app. And I want to avoid taking them manually using DDMS perspective.

Any info would be helpful. Thanks in Advance.

Was it helpful?

Solution

Is there any feature in eclipse that will automatically take screenshots of every screen while the app is running?

Yes, You can take a screenshot if you

open the Android view "devices" (under Window --> Show View --> Other... --> Android --> Devices). Click on the device or emulator you want to take a screen shot of, then click the "Screen Capture" button (it looks like a little picture, and it should be next to a stop sign button). Occasionally the device won't immediately load the picture; sometimes you have to close/reopen the screen capture window.

This is equivalent to taking a picture via DDMS, but you can do it in Eclipse instead of opening another application.

does this need to be done programatically?

Yes, you can also do it like it as Below Code Suggests.

// image naming and path  to include sd card  appending name you choose for file
String mPath = Environment.getExternalStorageDirectory().toString() + "/" + ACCUWX.IMAGE_APPEND;   

// create bitmap screen capture
Bitmap bitmap;
View v1 = mCurrentUrlMask.getRootView();
v1.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
v1.setDrawingCacheEnabled(false);

OutputStream fout = null;
imageFile = new File(mPath);

try {
    fout = new FileOutputStream(imageFile);
    bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fout);
    fout.flush();
    fout.close();

} catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

Then, when you need to access use something like this:

Uri uri = Uri.fromFile(new File(mPath));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top