As stated by another poster, this technique will not give you a _screen_ 
shot but a image of GUI elements within the activity.  They are not quite 
the same.  Also, some techniques for grabbing frame-buffer data can 
retrieve partially-drawn frames.

The only way I've found to reliably obtain a full-screen shot is via the 
DDMS library or equivalent (monkeyrunner,ChimpChat).

-- 
Lew

On Thursday, November 24, 2011 5:14:56 AM UTC-8, Mukesh Srivastav wrote:
>
> Let me give u [sic] an Example [sic]:
>
> Let's say you have a layout and it has a parent layout could be 
> (Relative,Absoulte or LinerLayout). Take the id out of it. Below are the 
> steps to do this.
>
> Step 1: Declare a Variable 
>
> View screen;
>
> Step 2: in public void onCreate(Bundle savedInstanceState)  Method
>
>    screen = (View) findViewById(R.id.captureimagelayout);  // Change your 
> Layout id here.
>
> Step 3:   in the Button onclick Listener do this.
>
> screen.setDrawingCacheEnabled(true);
> Bitmap imgToSave = screen.getDrawingCache();
>
>
> Step 4: in the Step 3# you have the Bitmap object,  use File:\\ operations 
>  to save the bitmap.  you are done. 
> As simple as that.
>
>
> Regards,
> Mukesh Kumar,
> Android Consultant/Freelancer.
> India,Hyderabad.
>
>
>
>
>
>
>
>
>
> On Thu, Nov 24, 2011 at 6:31 PM, Mark Murphy <[email protected]>wrote:
>
>> On Thu, Nov 24, 2011 at 5:57 AM, vani reddy <[email protected]> 
>> wrote:
>> > How to take the screeenshot of android device programmatically..Apart 
>> from
>> > using in DDMS.
>>
>> This is not supported by Android. There are ways to capture the image
>> of your own activity (I think using the drawing cache), but you cannot
>> programmatically capture images of other applications, for obvious
>> security and privacy reasons.
>>
>> --
>> Mark Murphy (a Commons Guy)
>> http://commonsware.com | http://github.com/commonsguy
>> http://commonsware.com/blog | http://twitter.com/commonsguy
>>
>> Android Training in NYC: http://marakana.com/training/android/
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>

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

Reply via email to