view.getDrawingCache() is deprecated in Android API 28

Two ways to get bitmap of view Using Canvas Using Pixel Api Canvas Java Bitmap getBitmapFromView(View view) { Bitmap bitmap = Bitmap.createBitmap( view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888 ); Canvas canvas = new Canvas(bitmap); view.draw(canvas); return bitmap; } Bitmap getBitmapFromView(View view,int defaultColor) { Bitmap bitmap = Bitmap.createBitmap( view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888 ); Canvas canvas = new Canvas(bitmap); canvas.drawColor(defaultColor); view.draw(canvas); … Read more

Screenshot showing up blank – Swift

update: Xcode 8.2.1 • Swift 3.0.2 You need to add the import statement and this extension to your game scene: import UIKit extension UIView { var snapshot: UIImage? { UIGraphicsBeginImageContextWithOptions(bounds.size, false, 0) defer { UIGraphicsEndImageContext() } drawHierarchy(in: bounds, afterScreenUpdates: true) return UIGraphicsGetImageFromCurrentImageContext() } } let myImage = view?.snapshot

Taking screenshot programmatically doesnt capture the contents of surfaceVIew

I finally solved this . Below i give some code for anyone who wants to know how to take screenshots of a layout ,pictures from the camera without intent, screenshots(sort of) of the content of a surfaceView and save the screen shot in a folder : public class Cam_View extends Activity implements SurfaceHolder.Callback { protected … Read more