Android Question get screenshot (rooted)

Similar threads

B4A Tutorial [java] Creating libraries for Basic4android
B4A Example Take a Screenshot with Inline Java Code
B4A Question PDFjetPDF
B4A Question Crop native to b4a
B4A Code Snippet Advertising id

peacemaker

Well-Known Member
Licensed User
How to get screenshot Bitmap on a rooted device ?

B4X:
private void captureScreen() {
        View v = getWindow().getDecorView().getRootView();
        v.setDrawingCacheEnabled(true);
        Bitmap bmp = Bitmap.createBitmap(v.getDrawingCache());
        v.setDrawingCacheEnabled(false);
        try {
            FileOutputStream fos = new FileOutputStream(new File(Environment
                    .getExternalStorageDirectory().toString(), "SCREEN"
                    + System.currentTimeMillis() + ".png"));
            bmp.compress(CompressFormat.PNG, 100, fos);
            fos.flush();
            fos.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

Please, help to get Bitmap, no file saving is needed.
 

peacemaker

Well-Known Member
Licensed User
Screenshot not by my app is needed, any other app on the rooted device.
 
Top