Where do I put a text file that I want deployed with my app such that I can provide within my app a path to that text file. I have an included JNI library which will take the text file at that path and perform actions on it. So in other words, I don't think I can just put it in my assets folder without reading the file and resaving it to SD card or something (as I don't think you can reference an assets file directly by path right?). Is there a way around this?
Asked
Active
Viewed 29 times
0
-
"I don't think you can reference an assets file directly by path right?" -- correct. "Is there a way around this?" -- not that I am aware of. While you can get to a Java `FileDescriptor` object for an asset, I am not aware of a way to get at a file descriptor `int` for use by native code. You could pass an `InputStream` into the JNI code, but that will be awkward for the native code to consume. Otherwise, copying to [internal storage](https://commonsware.com/blog/2014/04/07/storage-situation-internal-storage.html) is your most likely option. – CommonsWare Jun 23 '16 at 15:48
1 Answers
0
You can place files in res/raw/
and read them as raw resource files/streams.
See https://stackoverflow.com/a/15934525/5734895 for reading raw resources.

Community
- 1
- 1

omkarmoghe
- 76
- 1
- 6