Android Question get screenshot (rooted)

peacemaker

Expert
Licensed User
Longtime 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

Expert
Licensed User
Longtime User
Screenshot not by my app is needed, any other app on the rooted device.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…