Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>set the correct permissions in the manifest</p> <pre><code> &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; </code></pre> <p>below is a function that will programmatically move your file</p> <pre><code>private void moveFile(String inputPath, String inputFile, String outputPath) { InputStream in = null; OutputStream out = null; try { //create output directory if it doesn't exist File dir = new File (outputPath); if (!dir.exists()) { dir.mkdirs(); } in = new FileInputStream(inputPath + inputFile); out = new FileOutputStream(outputPath + inputFile); byte[] buffer = new byte[1024]; int read; while ((read = in.read(buffer)) != -1) { out.write(buffer, 0, read); } in.close(); in = null; // write the output file out.flush(); out.close(); out = null; // delete the original file new File(inputPath + inputFile).delete(); } catch (FileNotFoundException fnfe1) { Log.e("tag", fnfe1.getMessage()); } catch (Exception e) { Log.e("tag", e.getMessage()); } } </code></pre> <p>To Delete the file use </p> <pre><code>private void deleteFile(String inputPath, String inputFile) { try { // delete the original file new File(inputPath + inputFile).delete(); } catch (Exception e) { Log.e("tag", e.getMessage()); } } </code></pre> <p>To copy </p> <pre><code>private void copyFile(String inputPath, String inputFile, String outputPath) { InputStream in = null; OutputStream out = null; try { //create output directory if it doesn't exist File dir = new File (outputPath); if (!dir.exists()) { dir.mkdirs(); } in = new FileInputStream(inputPath + inputFile); out = new FileOutputStream(outputPath + inputFile); byte[] buffer = new byte[1024]; int read; while ((read = in.read(buffer)) != -1) { out.write(buffer, 0, read); } in.close(); in = null; // write the output file (You have now copied the file) out.flush(); out.close(); out = null; } catch (FileNotFoundException fnfe1) { Log.e("tag", fnfe1.getMessage()); } catch (Exception e) { Log.e("tag", e.getMessage()); } } </code></pre>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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