Android examples for Android OS:Shell Command
chgrp, change group via shell command
import java.io.File; import java.io.IOException; import android.util.Log; public class Main{ public static int chgrp(File f, String gid) { String cmd = "chgrp " + gid + " " + f.getAbsolutePath(); Log.i(Mocker.TAG, "Running command: " + cmd); return exec(cmd); }// w w w . jav a2s .c om private static int exec(String cmd) { try { Runtime runtime = Runtime.getRuntime(); Process p = runtime.exec(cmd); return p.waitFor(); } catch (IOException e) { e.printStackTrace(); return -1; } catch (InterruptedException e) { e.printStackTrace(); return -1; } } }