public static ArrayList<Tweet> fromJsonArray(JSONArray jsonArray) { ArrayList<Tweet> tweets = new ArrayList<Tweet>(); for (int i = 0; i < jsonArray.length(); i += 1) { JSONObject jsonObj = null; try { jsonObj = jsonArray.getJSONObject(i); } catch (JSONException je) { je.printStackTrace(); continue; } Tweet tweet = Tweet.fromJson(jsonObj); if (tweet != null) { tweets.add(tweet); } } return tweets; }