Я не знаю, что это MediaProjection, но я снимаю снимок экрана следующим образом:
private void takeScreenShot(View view) {
Bitmap bitmap = loadBitmapFromView(view, 1125, 1125); }
private Bitmap loadBitmapFromView(View v, int width, int height) {
final Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(bmp);
v.setDrawingCacheEnabled(true);
v.measure(
View.MeasureSpec.makeMeasureSpec(canvas.getWidth(), View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(canvas.getHeight(), View.MeasureSpec.EXACTLY));
v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
v.buildDrawingCache(true);
canvas.drawBitmap(v.getDrawingCache(), 0, 0, new Paint());
v.setDrawingCacheEnabled(false); // clear drawing cache
return bmp; }