添加静态JSON到Android Studio项目 [英] Adding static JSON to an Android Studio project

查看:245
本文介绍了添加静态JSON到Android Studio项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想静态JSON添加到,然后可以在整个项目中引用一个Android Studio项目。有谁知道这样做的最好的方法?

I'd like to add static JSON to an Android Studio project which can then be referenced throughout the project. Does anyone know the best method of doing this?

在更详细的我想要做的是这样的:
1)将数据从谷歌Places API而从
2)找到在静态JSON对象匹配的地方,谷歌的地方
3)根据比赛在地图上放置标记

In more detail what I'm trying to do is this: 1) Pull data out of the Google Places API 2) Find Google places that match with places in a static JSON object 3) Place markers on a map based on the matches

我有数字1和3的工作,但想知道在我的项目创建一个静态的(常量)JSON对象,并使用它的第2步的最佳方式。

I have numbers 1 and 3 working, but would like to know the best way of creating a static (constant) JSON object in my project and using it for step 2.

推荐答案

您只需将您的JSON文件转化为资产的文件夹。以后你就可以读取该文件,分析它,并使用值。

You can just place your JSON file into assets folder. Later on you'll be able to read the file, parse it and use values.

这篇关于添加静态JSON到Android Studio项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆