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

I think this is a pretty simple question.

I am currently writing a file as follows:

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

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

I read that I can do this by putting the full URL in "". BUT. Since this is an Android app. What is a full URL? I do not need to write / home /.../ myproject / ...?

Is the solution:

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

Or do I need a higher URL structure?

Sorry to ask this simple question, but since I am using the Android emulator, I cannot check if the file is really in the right place.

+6
source share
1 answer

You cannot write the file to the raw folder. Its read only. Similarly, you cannot change anything contained in the "Res" folder on the fly.

Check it out, fooobar.com/questions/514507 / ...

+8
source

Source: https://habr.com/ru/post/921188/


All Articles