Hi,
Depends...
If you want to develop an application yourself, you need to access the shell to issue a command.
For doing that and for doing what you are looking for, you normally need ROOT access to your device.

You should grab the standard input of the SU process just launched and write down the command there, otherwise you are running the commands with the current UID.
Try something like this:

try{

Process su = Runtime.getRuntime().exec("su");

.

.

.

su.waitFor();

}catch(IOException e){

throw new Exception(e);

}catch(InterruptedException e){

throw new Exception(e);

}

Copy the Code

If you want, you can use this library available in GITHUB: "https://github.com/Chainfire/libsuperuser" to access to ROOT from your app.
That's from Chainfire and you can add it to your gradle file:

dependencies {

compile 'eu.chainfire:libsuperuser:1.0.0.+'

}

Copy the Code

See the samples in their GIT and see how you can access shell by this library. Then you can issue any command you would like from you app.