Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.app.Activity;
import android.graphics.Bitmap;

import android.graphics.Canvas;

import android.view.View;

public class Main {
    public static Bitmap getScreenshotsForCurrentWindow(Activity activity) {
        View cv = activity.getWindow().getDecorView();
        Bitmap bmp = Bitmap.createBitmap(cv.getWidth(), cv.getHeight(), Bitmap.Config.ARGB_4444);
        cv.draw(new Canvas(bmp));
        return bmp;
    }
}