Here is my code:
public String loadJSONFromAsset() {
String json = null;
try {
InputStream is = getAssets().open("index.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;
}
JSONObject object = new JSONObject(loadJSONFromAsset());
I get an error underlining the last row(JSONObject object = new JSONObject(loadJSONFromAsset());), saying Unhandled Exception org.json.JSONException
Aucun commentaire:
Enregistrer un commentaire