Reputation: 11
I want to take screen shot programmatically in android when camera is live on surface view, I have also inflated multiple layouts on over surface view but when I'm trying to take screen shot programmatically then screenshot has been taken but issue is stay there one that is screenshot is black view means my picture which is live on surface view that not appear in screen shot.
Upvotes: 1
Views: 1090
Reputation: 1774
Have you tried something like this:
Process sh = Runtime.getRuntime().exec("su", null,null);
OutputStream os = sh.getOutputStream();
os.write(("/system/bin/screencap -p " + "/sdcard/img.png").getBytes("ASCII"));
os.flush();
Ofcourse, this works only if your device is rooted.
Read this: https://stackoverflow.com/a/14718588/1374065
Upvotes: 1