1. BackgroundWrite a blog Almost two years, wrote a 100+ article, the most popular article is also the most concern is how to achieve the Android system screenshot. In fact, we Google Android_screen_shot will find the right way, but those are many years ago, in the android4.* version, Android for the source code has been corrected, so that the previous methods can not be used. thank cjd6568358 This netizen, we discuss together, finally by he realizes the Android system screenshot function, in order to let later want this function of coder can take a few detours, we organize the code into open source project.
2. Ideas
In fact, the main idea or before my blog post mentioned that we are interested to see. "android4.3" a complete capture of the Android source screenshot event (different from the old version on the Internet) the attempt and failure analysis of android4.3 screenshot function Android 4.3 operating source Implementation System screenshot (no portability)Android4.0 above version background service intercepts the current screen summary across processes (referenced from cjd6568358)
3. How to use Using the method is also very convenient, enter the open source project, download the jar file to import your own project, call the function name: Takescreenshot (Context context, String Filefullpath) If the file full path is empty, the method automatically creates the file name at the current time and saves it in the/data/local/tmp folder
Project address: Please star after use, thank you!
/********************************
* This article from the blog "Bo Li Garvin"
* Reprint Please indicate the source : Http://blog.csdn.net/buptgshengod
******************************************/
Implementation of the screenshot of the Android system (with code)