he library you need is called libsurfaceflinger_client.so. You can pull it from any device running Gingerbread or higher version of Android, with command

adb pull /system/lib/libsurfaceflinger_client.so

On ICS or JB, class ScreenshotClient is part of libgui.so. The makefile for screencap which is the example of using ScreenshotClient, suggests that linker may need other libraries:

libcutils libutils libbinder libskia libui libgui

Also, the code of screencap.cpp goes as follows:

ScreenshotClient screenshot;if(screenshot.update()== NO_ERROR){base= screenshot.getPixels();  w = screenshot.getWidth();  h = screenshot.getHeight();  f = screenshot.getFormat();  size = screenshot.getSize();}else{constchar* fbpath ="/dev/graphics/fb0";int fb = open(fbpath, O_RDONLY);if(fb >=0){struct fb_var_screeninfo vinfo;if(ioctl(fb, FBIOGET_VSCREENINFO,&vinfo)==0){...

This means that at least you must check that update() succeed. Unfortunately, unless teh device is rooted, the apps cannot be granted permission to read from /dev/graphics/fb0 and use the fallback of /system/bin/screencap or /system/bin/screenshot.


问题产生链接

http://stackoverflow.com/questions/12560957/how-to-use-screenshotclient-in-my-android-application


代码阅读链接

http://code.metager.de/source/xref/android/4.0.3/


android sdk java源码

http://grepcode.com/snapshot/repository.grepcode.com/java/ext/com.google.android/android/4.4.2_r1/


相关链接

http://blog.sina.com.cn/s/blog_69a04cf4010173fz.html



更多相关文章

  1. Android(安卓)源码编译so,jar
  2. android导航条的制作
  3. 70个具有商业实战性的精品Android源码
  4. 关于查看Android系统源码【Written By KillerLegend】
  5. 如何使用Android(安卓)SDK开发Android应用?
  6. Android(安卓)开发工程师面试指南
  7. Android(安卓)小项目之--SQLite 使用法门 (附源码)
  8. Android属性动画,从源码的角度分析
  9. Android(安卓)技术专题系列之三 -- 编译(build) 流程

随机推荐

  1. android中的资源使用
  2. conversion to dalvik format failed wit
  3. android常用属性的学习
  4. (未解决)问题记录ionic android 签名之后
  5. android 按钮圆角
  6. (翻译) Android(安卓)Accounts Api使用指
  7. FFmpeg 2.8.4 移植到android平台(二)
  8. Android(安卓)Studio开发工具快捷键
  9. vitamio视频播放报错: java.lang.Unsatis
  10. 【安卓学习总结】安卓开发