Let me give u an Example:

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