code snippet
void takeSnapShot()
{
Process process = null;
try
{
process = Runtime.getRuntime().exec("/system/bin/screencap -p /sdcard/snapshot/test_2.png" );
try
{
process.waitFor();
} catch (InterruptedException e)
{
e.printStackTrace();
}
} catch (IOException e)
{
e.printStackTrace();
}
}
I get an empty file, but if I use the same command through the adb shell, I get my screen.
Any help would be appreciated.
source
share