Android: Screencap to bytes directly - Skip saving to file
问题 I use the following code to take screenshot on a rooted device: sh = Runtime.getRuntime().exec("su", null,null); os = sh.getOutputStream(); os.write(("/system/bin/screencap -p " + "/sdcard/img.jpg" + "\n").getBytes("ASCII")); os.flush(); os.close(); sh.waitFor(); myBitmap = BitmapFactory.decodeFile("/sdcard/img.jpg"); As i want to take screenshots frequently, I don't want to first save it to the file and then read the bytes. Is there a better way to get the screenshot bitmap directly? I just