aspose file tools*
The moose likes Android and the fly likes How do I take screenshot of main screen in android programmatically? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "How do I take screenshot of main screen in android programmatically?" Watch "How do I take screenshot of main screen in android programmatically?" New topic
Author

How do I take screenshot of main screen in android programmatically?

Zubin Methew
Greenhorn

Joined: Mar 28, 2014
Posts: 2
I need to take screenshots of main screen through my application. I am using the following code but it gives an image of 0Bytes. Please let me know that what I am doing wrong .


Any kind of help would be appreciated. Thanks in advance.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

The code you posted would require the phone to be rooted, and probably requires super user privileges. Do you need a screenshot of your application or a screenshot of the phone (even stuff not in your application)? I think taking a screenshot of your application can be done by painting the root view onto a bitmap. I don't know if you can take a screenshot of the phone (outside your application) without super user privileges or some work around (a quick search identified a means using a service the user would have to start from a PC via the Android SDK... but that hardly seems reasonable.)


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I take screenshot of main screen in android programmatically?