I have a class 'AdResources'. I created a list to hold AdResources objects
private List<AdResources> adResourcesList = null;
Then I created an AdResources object AdResources map = new AdResources();
I also added some data to map by map.setType(((JSONArray)nearbyPlacesData.get(i)).optString(0)); (Nothing is null here, cross checked)
After all this I do adResourcesList.add(map);. I get null pointer exception here. This is weird because running a debugger, just before executing adResourcesList.add(map) I can see that the map object is not null, hence why the NPE?
Also to be noted is, I am running this from an AsyncTask doInBackground.