External To Internal memory and vice-versa file transfer and remove file from source location: Android 4.4+

时光总嘲笑我的痴心妄想 提交于 2019-12-25 03:14:44

问题


I am trying to copy/move file from one location to another location, renaming file and deleting original file but its getting error like file not found exception (/storage/sdcard1/Video/hffg.mp4: open failed: EACCES (Permission denied))

In Manifest permission already given:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Problem is to transfer file from ("/storage/emulated/0/video/hffg-v-5398.mp4") location to ("/storage/sdcard1/Video/hffg.mp4") with renaming file by removing ("-v-5398")

The above problem occur only while I'm trying to copy/move file from internal memory to external memory.

I'm referring the SO How to programmatically move, copy and delete files and directories on SD?

The Answer is working perfect while file transfer perform between internal memory but throwing error on internal to external file transfer process.

I am also performing file Renaming before copy/move file.

  1. how can I transfer File from Internal to external storage ?
  2. how to remove/delete file from external storage ?
  3. is it possible to execute above both task with predefined path stored in database ? (i.e: "/storage/sdcard1/Video/hffg.mp4")

来源:https://stackoverflow.com/questions/53513306/external-to-internal-memory-and-vice-versa-file-transfer-and-remove-file-from-so

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!