之前账号的文章3:android私有存储目录下的文件如何让其他程序有权限打开

来源:互联网 发布:太阳系知识知多少 编辑:程序博客网 时间:2024/05/15 07:01

解决方法:

1这段代码是关键:

public void shell() {    Process p;    int status = -1;    try {        p = Runtime.getRuntime().exec("chmod 777 " + file);        status = p.waitFor();    } catch (IOException e1) {        e1.printStackTrace();    } catch (InterruptedException e) {        e.printStackTrace();    }    if (status == 0) {    } else {    }}
2.调用shell()之后,启动其他程序即可,以android版wps举例,如果没加就会报数据丢失或空白的错误。
0 0
原创粉丝点击