当前位置:操作系统 > 安卓/Android >>

Android修改文件和文件夹权限

[java] 
// 修改权限  
public static void chmod(String permission, String path) { 
    try { 
        String command = "chmod " + permission + " " + path; 
        Runtime runtime = Runtime.getRuntime(); 
        runtime.exec(command); 
    } catch (IOException e) { 
        e.printStackTrace(); 
    } 

// 修改权限
public static void chmod(String permission, String path) {
 try {
  String command = "chmod " + permission + " " + path;
  Runtime runtime = Runtime.getRuntime();
  runtime.exec(command);
 } catch (IOException e) {
  e.printStackTrace();
 }
}[java] view plaincopyprint?chmod("777", mContext.getFilesDir().toString()); 

chmod("777", mContext.getFilesDir().toString());

 

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,