sczhg sczhg - 7 months ago 43
Android Question

How to store initial data in android apk file?

I'm writing an android weather app, which needs a city information list.

The list is quite long, and spends long time to be downloaded from internet.

So I want to save it in my .apk file, and load it without internet connection, but don't know how.

I tried to save it in a java class, but it's toooo huge and costs much memory.

Are there some ways to solve it? Thx!


did you look at res/assets?

I assume that you probably have some sort of json/xml data that you want to pre-package with your app if so, then load the json/xml into the res/assets and it'll just be a file included with your apk.