taking screenshot of device screen [duplicate]

北城余情 提交于 2019-12-13 23:53:40

问题


I know this question has been asked many times.I am aware of two ways to do it.(1)Using screenshot library(But I am getting black screen all the time).(2)getting data from frame buffer with rooting||\dev\graphics\fb0||(But it is always 0 byte and I do not know exact location where current screenshot of device is stored).My preferred requirement is getting better frame rate.Any help will be very helpful as I have spent a lot of time in this.


回答1:


You can get the drawing cache of your view using the following code:

    view.setDrawingCacheEnabled(true);
    view.buildDrawingCache();
    Bitmap b1 = view.getDrawingCache();



回答2:


You can use this:

$ adb shell screencap -p /mnt/sdcard/sc.png
$ adb pull /mnt/sdcard/sc.png


来源:https://stackoverflow.com/questions/15117870/taking-screenshot-of-device-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!