0
我从我的应用程序中获取Android设备的屏幕截图,在我的华为设备中没有screencap实用程序,但现在我通过从其他设备添加它,现在可以使用screencap捕获屏幕,但只有通知栏可见,其余图像为空白。使用screencap实用程序获取屏幕截图时的屏幕截图使用screencap实用程序获取屏幕截图
我从我的应用程序中获取Android设备的屏幕截图,在我的华为设备中没有screencap实用程序,但现在我通过从其他设备添加它,现在可以使用screencap捕获屏幕,但只有通知栏可见,其余图像为空白。使用screencap实用程序获取屏幕截图时的屏幕截图使用screencap实用程序获取屏幕截图
adb shell /system/bin/screencap -p /sdcard/img.png this is a shell command take screenshot simple and fast
Try 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();
os.close();
sh.waitFor();
我已经实现了相同的代码,但得到空白屏幕的问题 – user2211088