Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple Audio files won't concatenate
    primarykey
    data
    text
    <p>I'm trying to create a simple recorder which gives 'pause' and 'resume' functionality to the user.</p> <p>Since Android does not support this directly, I'm creating individual files whenever the user presses 'Pause' and 'Resume' with the suffixes _1, _2, so on.</p> <p>I use the code below to concatenate them</p> <pre><code>public void mergeAllAndSave() { // TODO Auto-generated method stub Enumeration&lt;FileInputStream&gt; allRecordings; Vector&lt;FileInputStream&gt; audiofiles = new Vector&lt;FileInputStream&gt;(); for (int i = 1; i &lt; count+1; i++) { try { audiofiles.add(new FileInputStream(Environment.getExternalStorageDirectory().getPath() + "/"+ AUDIO_RECORDER_FOLDER + "/" + _filename + "_"+ i + file_exts[currentFormat])); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } allRecordings = audiofiles.elements(); SequenceInputStream siStream = new SequenceInputStream(allRecordings); try { FileOutputStream foStream = new FileOutputStream(Environment.getExternalStorageDirectory().getPath() + "/"+ AUDIO_RECORDER_FOLDER + "/" + _filename + file_exts[currentFormat]); int temp; while ((temp = siStream.read() ) != -1) { foStream.write(temp); } foStream.close(); siStream.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } </code></pre> <p>The code works fine. It gives me a single file. However it contains the contents of the first file only. Logcat does not show any errors, whatsoever.</p> <p>Anyone with any ideas what is the mistake I am making?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload