Francis pointed out a couple things in several emails:
On line 158 of your sketch code, you’re trying to load an image for SFOIconURL when you’re parsing the Honolulu data.
Ok, fixed that. As for the Twitter stuff not working (the line in bold is where I was getting a NullPointerException after fixing the Honolulu icon URL):
Just looking at your code, I’d also be worried that you’re parsing for weather data first regardless if it’s a weather request or a twitter request:
void responseReceived(HttpRequest request, HttpResponse response) {
//// check for HTTP 200 success code
if (response.statusCode == 200) {
println(response.getContentAsString());
JSONObject results = response.getContentAsJSONObject();
locationInfo = results.get(“current_observation”).get(“display_location”).get(“full”).stringValue();
currentTime = results.get(“current_observation”).get(“observation_time_rfc822”).stringValue();
tempF = results.get(“current_observation”).get(“temp_f”).floatValue();
…
If it’s the response from a Twitter request, you’ll be getting a whole bunch of NullPointerExceptions from this code.
And because I didn’t get it the first time:
What request is being handled when the NullPointerException occurs? As I mentioned previously, you’re handling all successful requests coming as Weather API requests, which will cause problems when the Twitter API responses start coming in.
I looked at the Processing console and it was indeed the Twitter data that’s being handled right before I get the error. I’ll be working on a solution to that tonight.
Permalink: http://tmblr.co/ZtI-YwDBnQqV