I have been searching around and can not seem to find a way to download a media file from my website and save it to my app's raw resource folder. What is the best way to do this? Any help is greatly appreciated.
Asked
Active
Viewed 472 times
-2
-
You can't write to the `raw` resource folder. It can only be read. The main purpose of `raw` is to ship the resource with the app, which can then be accessed by the app without modifying. You must save the media file to **Internal** or **External** storage of the device. – Monish Kamble Dec 26 '16 at 05:21
-
What is the easiest way to download and access it from the Internal Storage? – TheAnonymous010 Dec 26 '16 at 05:25
-
There are a lot of online examples for this. See one here: http://stackoverflow.com/questions/5729839/android-mp3-file-download?noredirect=1&lq=1 – yakobom Dec 26 '16 at 05:28
-
Download the file using [HttpURLConnection](https://developer.android.com/reference/java/net/HttpURLConnection.html) or any other third party library and save it on Internal or External storage. What kind of files you are downloading? – Monish Kamble Dec 26 '16 at 05:29
-
Music files. (mp3) – TheAnonymous010 Dec 26 '16 at 05:30
-
@yakobom Thanks for the link. I'm going to try it out. – TheAnonymous010 Dec 26 '16 at 05:30
-
maybe this helps..! http://stackoverflow.com/questions/5729839/android-mp3-file-download?noredirect=1&lq=1 – EasyE Dec 26 '16 at 11:42
2 Answers
1
You can't access resource folder once your app is installed. So you can't access raw folder for WRITE after installation. So better to use internal storage to store this file.

Kush Patel
- 1,228
- 1
- 13
- 34
1
You cannot do that, you can only read from the 'raw' and 'assets' folders. Either use internal storage, or if relevant - APK Expansion Files.

yakobom
- 2,681
- 1
- 25
- 33