Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write a file in Android to the raw folder?

Tags:

java

android

I think this is a pretty basic question.

I am currently writing a file like this:

File output = new File("exampleout.mid");

Now, I want to write the file to ../myproject/res/raw

I read I could do it by putting the complete url in the "". BUT. Since this is an Android app. What is the full url? I don;t have to write /home/.../myproject/...?

Is the solution:

File output = new File("/res/raw/exampleout.mid");

Or do I need a higher url structure?

Sorry about asking this simple question, but since I use an Android emulator, I cannot check if the file is actually in the right place.

like image 642
dorien Avatar asked Jul 24 '12 09:07

dorien


1 Answers

You cannot write a file to raw folder. Its read-only. Precisely you can't modify anything contained within "Res" folder on the fly.

Check this out, https://stackoverflow.com/a/3374149

like image 81
Andro Selva Avatar answered Sep 23 '22 08:09

Andro Selva