/*** Screenshot method ** @ Param view * @ Param path * @ Param filename */public static Boolean takescreenshot (view, string path) {Boolean issucc = false; /*** to obtain its cache, you must first enable the cache using the setdrawingcacheenable method. * Then call the getdrawingcache method to obtain the cache image of the view. * The builddrawingcache method does not need to be called, because when the getdrawingcache method is called, * If the cache is not created, the system automatically calls the builddrawingcache method to generate the cache. * To update the cache, you must call the destorydrawingcache method to destroy the old cache. * to create a new cache. */View. setdrawingcacheenabled (true); // enable cache view retrieval. builddrawingcache (); Bitmap bitmap = view. getdrawingcache (); // get the view's cache canvas = new canvas (Bitmap); int W = bitmap. getwidth (); int H = bitmap. getheight (); paint = new paint (); paint. setcolor (color. yellow); simpledateformat simple = new simpledateformat ("yyyymmddhhmmss"); string time = simple. format (new date (); // canvas. drawtext (time, w-w/2, H- H/10, paint); canvas. Save (); canvas. Restore (); fileoutputstream Fos = NULL; try {file sddir = new file (PATH); If (! Sddir. exists () {sddir. mkdir ();} file = new file (path + time + ". jpg "); Fos = new fileoutputstream (File); If (FOS! = NULL) {bitmap. compress (bitmap. compressformat. JPEG, 100, FOS); FOS. close (); issucc = true ;}} catch (exception e) {e. printstacktrace ();} return issucc ;}