原文:http://blog.csdn.net/ericahdu/article/details/5790055
首先声明这边搞出来的不是jpg也不是png,是rgb16文件,有很多工具可以直接打开看到图片的,大家也可以自己写个程序把它转成图片
其实/dev/graphics/fb0文件就是rgb16文件,如果你有busybox,那么直接用process调用shell把它copy出来就行了,没必要往下看,如果没有,那么我这边提供了一个解决办法:
用cat命令读取fb0文件
- Process p = Runtime.getRuntime().exec("cat /dev/graphics/fb0");
然后提取它的返回值
- InputStream inputStream = p.getInputStream();
把返回的inputStream保存成文件,用下面这个函数
- public boolean copy(InputStream is, String fileTo) {
- try {
- InputStream in = is;
- FileOutputStream out = new FileOutputStream(fileTo);
- byte[] bt = new byte[1024];
- int count;
- while ((count = in.read(bt)) > 0) {
- out.write(bt, 0, count);
- }
- in.close();
- out.close();
- return true;
- } catch (IOException ex) {
- return false;
- }
- }
这样就能把fb0文件拷贝出来了,你自己再写个rgb16到jpg的转换就可以了,有了root,其实很简单,^_^