Use PrintWriter to recreate a text file in /res/raw/ with android? -


I am preparing an app where the configuration file needs to be rewritten on startup and to make it printware It has to be used. The problem is printWriter takes a file as a parameter. Is there a way to refer to a text document in / res / raw / to fit the parameters of PrintWriter?

I do not know if this will help from that but here's some code to better my interpretation of the question: (This is the original idea but does not work ...)

  PrintWriter author = new print-author (new file ("res / raw / config.txt")); / * (I need to get my config file ... here) * /  

< P> You can not write to res / raw directory because it is part of your APK file. You must either save the configuration file priority by using the PreferenceManager.getDefaultSharedPreferences , or write the file in your app personal directory. You can create a file like this:

  PrintWriter author = new Print Writer (context.openFileOutput ("config.txt", MODE_PRIVATE));  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -