2

I want to take a screen shot in android irrespective of the application and without rooting the phone. I have seen into the previous thread link I followed this instructions but they are specific to one application. And we need to change the layout file of every application.

I also came across the link which is a library. One thing which is not clear to me in this is that whether the manifest.xml file should be changed for every application.

Can you please let me know if any other ways are possible? I know this is a security issue but if the application doesnt mind I need to take the screen shots.

Thanks.

Community
  • 1
  • 1
vinay
  • 21
  • 6
  • Do you need this for your own applications at runtime for some reason, or could you just do it via eclipse? – Idistic Jul 10 '11 at 20:40
  • I need it to take other applications screen shots and it should run on the phone .. not using eclipse – vinay Jul 10 '11 at 21:08
  • Based on the comments so far I am not sure what you are trying to accomplish If you are trying to take screen shots of other 3rd party applications that you don't have source code to then your application will never be active to take them. If you intend to put this into a service and have the screen shots taken at intervals that might work and I would use your second link. – Idistic Jul 10 '11 at 21:22
  • Yes I will run it as a service and take screen shots,but the question I have in the second link is : the sample which they told to add to the manifest.xml ,should it be added to each application ? Where should I add it? – vinay Jul 10 '11 at 21:37
  • You can't add anything to a 3rd parties application, what they are showing is that you need to add this to your services manifest in this case so that it can use that service. Not sure if their lib will work in a service guess you will have to try it. – Idistic Jul 10 '11 at 21:44
  • possible duplicate of [How to programatically take a screenshot on Android?](http://stackoverflow.com/questions/2661536/how-to-programatically-take-a-screenshot-on-android) – Aleks G Oct 23 '12 at 10:45

1 Answers1

3

if you don't need the status bar (or keyboard) you can do this in your activity:

View root = findViewById(android.R.id.content);
root.setDrawingCacheEnabled(true);
Bitmap bm = Bitmap.createBitmap(root.getDrawingCache());
root.setDrawingCacheEnabled(false);

Completely untested but it should work.


After seeing your comment about taking screenshots of other applications I do not believe that what you want is possible without rooting the phone.

Nicklas A.
  • 6,501
  • 7
  • 40
  • 65
  • I need to take the screen shot of an advertisement,so I need to take screen shots of another application. What do you think about the library which is provided? – vinay Jul 10 '11 at 21:29
  • I think it's only for your service you do that. Still not sure if this will work without root, if so that's a big fail on google's part – Nicklas A. Jul 10 '11 at 21:35
  • Thank you i will try it and let you know – vinay Jul 10 '11 at 21:58