My app uses Eventbrite API and it crashes when event logo is null.
JSONObject jsonRootObject = new JSONObject(event);
JSONArray jsonArray = jsonRootObject.optJSONArray("events");
JSONObject jsonObject = jsonArray.getJSONObject(i);
information = jsonObject.getJSONObject("logo");
text = information.getString("url");
name = "eventsImage" + i;
resId = getResources().getIdentifier(name, "id", getPackageName());
new LoadImagefromUrl().execute(new LoadImagefromUrlModel(text, resId));
I am trying to make exception for this event, but I am not very experienced with JSONObjects and I don't know how if statement should look like
I have tried the following, but it didn't work
jsonObject.getJSONObject("logo")!=null