V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
moodasmood
V2EX  ›  Android

不想加班了,求救!

  •  
  •   moodasmood · 2019-05-14 18:06:15 +08:00 · 3294 次点击
    这是一个创建于 1780 天前的主题,其中的信息可能已经有所发展或是发生改变。
    String commend = "screencap";
    Process p = Runtime.getRuntime().exec("su");
    DataOutputStream dos = new DataOutputStream(p.getOutputStream());
    DataInputStream dis = new DataInputStream(p.getInputStream());
    dos.writeBytes(commend + "\n");
    dos.flush();
    dos.writeBytes("exit\n");
    dos.flush();
    //I/System.out: ������������������ÿÿÿ
    System.out.println(dis.readLine());
    byte[] b=new byte[1000000];
    //b is empty
    dis.read(b);
    p.waitFor();
    

    安卓大佬有木有,顺手帮我解决这个问题,我就下班走人了。。这段代码 readLine 能拿到返回,但是却拿不到二进制数据,咋破?这个返回应该是当前屏幕的截屏数据。已经给 root 权限了

    xieguanglei
        1
    xieguanglei  
       2019-05-14 19:54:53 +08:00   ❤️ 1
    stack-ov2ex ……
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   958 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 20:40 · PVG 04:40 · LAX 13:40 · JFK 16:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.