Browse - Programming Tips - How can I do a screenshot from java code?

Date: 2015may13
OS: Android
Keywords: screen capture
Language: java

Q.  How can I do a screenshot from java code?

A.  If you have root access:

String a [] = { "/system/bin/screencap", "-p", "/sdcard/screen.png" }; Runtime.getRuntime().exec(a);