dorien
dorien

Reputation: 5387

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

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.

Upvotes: 7

Views: 12728

Answers (2)

Moreno
Moreno

Reputation: 180

If you want to use iText on Android or the Google App Engine, you need to use iTextG.

dependencies {
    compile 'com.itextpdf:itextg:5.5.10'
}

Source: iText Official Site

Upvotes: 0

Andro Selva
Andro Selva

Reputation: 54322

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

Upvotes: 11

Related Questions