首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

java更动android文件权限-待验证

2012-12-18 
java更改android文件权限--待验证public static boolean runRootCommand(String command) { // chmod 777

java更改android文件权限--待验证
public static boolean runRootCommand(String command) { // "chmod 777 " +
        // destFile.getAbsolutePath()--/system/etc/
        Process process = null;
        DataOutputStream os = null;
        try {
            process = Runtime.getRuntime().exec("su");
            os = new DataOutputStream(process.getOutputStream());
            os.writeBytes(command + "\n");
            os.writeBytes("exit\n");
            os.flush();
            process.waitFor();
        } catch (Exception e) {
            Log.d("*** DEBUG ***", "Unexpected error - Here is what I know: "
                    + e.getMessage());
            return false;
        } finally {
            try {
                if (os != null) {
                    os.close();
                }
                process.destroy();
            } catch (Exception e) {
                // nothing
            }
        }
        return true;
    } 1 楼 frejus 2011-07-15   不能用,sdk不包含这些类

热点排行