Android: what is the best way to store JSON data offline for the app in android?

前端 未结 3 842
心在旅途
心在旅途 2021-02-05 18:42

I want to implement an app, that will show the route number, the rider has boarded in google map. So to find the route number I need some information about the routes, which are

3条回答
  •  忘了有多久
    2021-02-05 18:52

    You store abitrary files that you like to package with your app in the assets folder

    https://developer.android.com/tools/projects/index.html

    main/assets/

    This is empty. You can use it to store raw asset files. Files that you save here are compiled into an .apk file as-is, and the original filename is preserved. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the AssetManager. For example, this is a good location for textures and game data.

    See this question on how to read from assets.

提交回复
热议问题