将该文件放入资产中 。
对于在Android Studio项目中创建的项目,您需要在主文件夹下创建资产文件夹。
将该文件读取为:
public String loadJSonFromAsset(Context context) { String json = null; try { InputStream is = context.getAssets().open("file_name.json"); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); json = new String(buffer, "UTF-8"); } catch (IOException ex) { ex.printStackTrace(); return null; } return json; }然后您可以简单地
string通过此函数读取此返回
JSonObject obj = new JSonObject(json_return_by_the_function);
有关JSON的更多详细信息,请参见
http://www.vogella.com/articles/AndroidJSON/article.html
希望你能得到想要的。



