I have a class compositionJSON. The class has a method calls makeJSONObject, that creates a JSON-Object and put stuff in it. Here is the code of the class.
p
In the method makeJSONObject you instantiate a new JSONObject.
this code should work.
public void makeJSONObject (String title, String desc, ArrayList imgPath, ArrayList imgView) {
try {
this.put("title", title);
this.put("desc", desc);
this.put("imgPath", imgPath);
this.put("imgViewPath", imgView);
} catch (JSONException e) {
e.printStackTrace();
}
}