我正在尝试在android中获取设备的屏幕截图,我使用下面的代码进行屏幕截图,它适用于图像和小部件但是当视频正在运行并尝试获取它的屏幕截图时,它给出了以下错误。我该如何解决这个问题,我得到了在屏幕上播放视频的截图
Do partial code cache collection, code=26KB, data=30KB
After code cache collection, code=26KB, data=30KB
Increasing code cache capacity to 128KB
代码
Bitmap image = Utils.screenShot(activity.getWindow().getDecorView().getRootView());
image = Utils.getResizedBitmap(image, 500);
public static Bitmap screenShot(View view) {
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(),
view.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
view.draw(canvas);
return bitmap;
}