java - Storing a file as part of android manifest for deployment and then opening it? -


Okay I know this dead should be simple, but I think that I have my question correctly in my Google I'm not writing; Stackoverflow searches

I have a substantial amount of static data (6 megs), I need to load it in my database on install. Right now I am bringing Jason data file from my web server for the first time and populating my database, but it can be slow and something can be wrong. I just like to include the data file in the manifest and then load it on install or run it for the first time.

So, where do I put files, do this so that this goal ends up on the device, and then open it?

I have tried it in / res / files / and then:

InputStream inputStream = new FileInputStream ("/res/files/foo.json");

But of course I am afraid that if he has done it.

When I'm on it, I should cut the format instead of CSV, but it's another story, I have no way to parse it, but I know that JSON data How to parse me. I'm sorry, I'm a bit new on this. You can store it in property or

.

How to open it from the assets folder:

  InputStream = getAssets (). Open ("foo.json");  

How to open it from the res \ raw folder:

  getResources (). OpenRawResource (R.raw.foo));  

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 -