我正在使用通过WiFi连接的多个表(都是根目录)共享平板电脑显示,我使用了以下方法(都在一个线程中):
1-我会截屏。
Process sh = Runtime.getRuntime().exec("su", null,null);
OutputStream os = sh.getOutputStream();
os.write(("/system/bin/screencap -P " + "/sdcard/test/img.png").getBytes("ASCII"));
os.flush();
os.close();
sh.waitFor();2-压缩截图图像。
Bitmap mBitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory().getPath() + "/test/img.png");
OutputStream outputStream = null;
File file = new File(Environment.getExternalStorageDirectory().getPath() + "/test/img2.png");
outputStream = new FileOutputStream(file);
mBitmap.compress(Bitmap.CompressFormat.JPEG, 15, outputStream);
outputStream.flush();
outputStream.close();3-打开插座并将压缩图像发送到另一台平板电脑。
这是有效的,但我的问题是在另一个平板电脑上的观看延迟它花了4-5秒刷新新的显示,有没有更好的方法让它实时显示?
发布于 2013-06-08 03:28:40
不幸的是,这个功能需要很长时间。它与进程生命周期、IPC和慢速文件系统联系在一起。您需要查看this library或source code of /system/bin/screenshot util.,您必须重用源代码中的本机(c语言)函数,这不是一项简单的任务。
https://stackoverflow.com/questions/16948607
复制相似问题