How to pause the current loop without pausing current running thread in Android / Java?

In my android application, In my fragment, I have one while loop like startMs=0, endMs=30000; while(i<10){ new Mp4Composer(inputPath, destPath) .trim(startMs, ...