title: Copy multiple files from asset to internal storage
body: <p>This is the original code for copying one file from asset to internal storage I found online:</p>
  
  <pre><code>Context Context = getApplicationContext();
  String DestinationFile = Context.getFilesDir().getPath() + File.separator + "DB.sqlite";
  if (!new File(DestinationFile).exists()) {
    try {
      CopyFromAssetsToStorage(Context, "Database/DB.sqlite", DestinationFile);
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
  
  private void CopyFromAssetsToStorage(Context Context, String SourceFile, String DestinationFile) throws IOException {
    InputStream IS = Context.getAssets().open(SourceFile);
    OutputStream OS = new FileOutputStream(DestinationFile);
    CopyStream(IS, OS);
    OS.flush();
    OS.close();
    IS.close();
  }
  private void CopyStream(InputStream Input, OutputStream Output) throws IOException {
    byte[] buffer = new byte[5120];
    int length = Input.read(buffer);
    while (length &gt; 0) {
      Output.write(buffer, 0, length);
      length = Input.read(buffer);
    }
  }
  </code></pre>
  
  <p>The above code is working fine for copying one file. However, what I want is to copy multiple files instead of one file. Following MT8, I modified my the code to below:</p>
  
  <pre><code>public class MainActivity extends Activity{
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
              ArrayList&lt;String&gt; destFiles = new ArrayList&lt;String&gt;();
              destFiles.add("FileB.jpg");
              destFiles.add("FileC.jpg");
              destFiles.add("FileD.jpg");
  
              for(int i =0 ; i &lt; destFiles.size(); i++) {
              Context Context = getApplicationContext();
              String DestinationFile = Context.getFilesDir().getPath() + File.separator + "FileA.db";
              if (!new File(DestinationFile).exists()) {
                try {
                  CopyFromAssetsToStorage(Context, "database/FileA.db", destFiles.get(i));
                } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                }
              }
              }
      }
  
              private void CopyFromAssetsToStorage(Context Context, String SourceFile, String DestinationFile) throws IOException {
                InputStream IS = Context.getAssets().open(SourceFile);
                OutputStream OS = new FileOutputStream(DestinationFile);
                CopyStream(IS, OS);
                OS.flush();
                OS.close();
                IS.close();
              }
              private void CopyStream(InputStream Input, OutputStream Output) throws IOException {
                byte[] buffer = new byte[5120];
                int length = Input.read(buffer);
                while (length &gt; 0) {
                  Output.write(buffer, 0, length);
                  length = Input.read(buffer);
                }
              }
  }
  </code></pre>
  
  <p>However, the files won't be copied. Any part that I did wrongly?</p>