I have a rooted device and I successfully capture the screenshot of current screen, using this code:
Process process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
os.writeBytes("/system/bin/screencap -p " + path + "; \n");
But in the command I provide the path where I want to save the file and the system takes time to write the image in the file. Can we directly take the image data from process in the form of bytes? I want to send the current image to the server immediately.