How to increase the speed of commands in Android?


Hello everyone

My problem: I am in the situation of being able to increase the speed of the commands on the android devices, because I have entered Root permissions and for this I must use the command terminal as Root to perform Root movements, one of them is the copy command (cp), and since I move large files from one place to another I find myself in need of increasing that speed, I do not know if it can be done by a command that increases the speed of execution or processing of the commands or by another command that allows to put my process in a position of the first ones in the execution list of android, or if there is some other form from java code or others.

My code:

        public boolean copiar(){
        String[] command = {"su", "-c", "cp", "ruta del fichero", "ruta a copiar"};

            try {
                Process proc = Runtime.getRuntime().exec(command);
                Toast.makeText(this, "Si", Toast.LENGTH_LONG).show();
            } catch (IOException e1) {
                // TODO Auto-generated catch block

    boolean verdadero = true;
    return true;


Copying is done from the sdcard and SD card with the partition system, data. etc, where the user wants to put it

If you know something about it, I'll be happy to hear it. Thanks

asked by Abraham.P 06.03.2017 в 23:14

1 answer


I advise you to use FileChannel if the size of the files is large. Try the following code and compare execution times.

public void copy(File src, File dst) throws IOException {
FileInputStream inStream = new FileInputStream(src);
FileOutputStream outStream = new FileOutputStream(dst);
FileChannel inChannel = inStream.getChannel();
FileChannel outChannel = outStream.getChannel();
inChannel.transferTo(0, inChannel.size(), outChannel);
answered by 07.03.2017 / 13:05