Android: escritura fallida: error de EPIPE (tubería rota) en el archivo de escritura
Estaba intentando hacer una captura de pantalla de la pantalla de Android programáticamente. Yo había hecho el siguiente código:
private void getsnap(){
try{
Process sh = Runtime.getRuntime().exec("su", null, null);
OutputStream os = sh.getOutputStream();
String filePath = this.getFilesDir().getPath().toString() + "/fileName1.jpeg";
os.write(("/system/bin/screencap -p " + filePath).getBytes("ASCII"));
os.flush();
os.close();
sh.waitFor();
}
catch (Exception e)
{
e.printStackTrace();
}
}
java.io.IOException: write failed: EPIPE (Broken pipe)
Por favor alguien puede ayudar? Ya había revisado las otras publicaciones y no encuentro nada para resolver mi problema.
EDITAR:
Tenga en cuenta, el error ocurre en la líneaos.write()
.