私は資産のJSONファイルを持っていると私は私のMainActivity方法でそれを読むためにしようとしている:ログでロードJSON
private static List<JSONObject> getJSONArray(Context context) {
JSONArray myJSONarr=new JSONArray();
try
{
AssetManager am = context.getAssets();
InputStream is = am.open("chineesecardsdata.json");
String resultJson = is.toString();
is.close();
Log.d("mainActLog","file read ok: "+resultJson);
try {
}
catch (JSONException e)
{
}
}
catch(
IOException e)
{
Log.d("mainActLog","file read fail");
}
}
は私が持っている:
ファイルには、[OK]をお読みください。 [email protected]
可能な複製(https://stackoverflow.com/questions/9544737/read-file-from-assets)私は静的である方法を必要とする –