Execute chmod command - Android Android OS

Android examples for Android OS:Shell Command

Description

Execute chmod command

Demo Code

import java.io.IOException;

public class Main {

  public static boolean chmod(String permission, String path) throws IOException, InterruptedException {
    String command = "chmod " + permission + " " + path;
    Runtime runtime = Runtime.getRuntime();
    Process p = runtime.exec(command);
    int status = p.waitFor();
    // chmod succeed
    // chmod failed
    return status == 0;
  }/* ww w . ja v  a2  s . c  o  m*/

}

Related Tutorials