3

I have an activity with some views, after doing some stuff I want to convert the look of this activity into an image and email it. I can mail an image, but how can i make that activity into an image? Is it possible?

Sabbir Ahmed
  • 2,297
  • 2
  • 15
  • 13
  • 1
    Try SO - [http://stackoverflow.com/questions/3067586/how-to-capture-the-android-device-screen-content][1] [1]: http://stackoverflow.com/questions/3067586/how-to-capture-the-android-device-screen-content – karakuricoder Mar 26 '12 at 20:13

2 Answers2

2

You could programatically take a screenshot of your device, that should do the trick. Take a look at this SO answer, it should get you started.

Community
  • 1
  • 1
GETah
  • 20,922
  • 7
  • 61
  • 103
0

You can render different views of your app to Bitmap Objects, by capturing the drawing cache.

just refer to http://blog.neurolive.net/2010/11/385/ for more details. (thx, for the great tutorial)

especially

private Bitmap getScreenViewBitmap(View v) {
    v.setDrawingCacheEnabled(true);

    // this is the important code :)  
    // Without it the view will have a dimension of 0,0 and the bitmap will be null          
    v.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), 
                MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
    v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight()); 

    v.buildDrawingCache(true);
    Bitmap b = Bitmap.createBitmap(v.getDrawingCache());
    v.setDrawingCacheEnabled(false); // clear drawing cache
}

seems what you would be interested in. (Just find your top-level View and use this method to capture the Bitmap)

saberrider
  • 585
  • 3
  • 16