Back to project page test-gradle.
The source code is released under:
Copyright (c) <2013> <Paul Estrada> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the S...
If you think the Android project test-gradle listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.listexample.utils; /*ww w . j a v a 2s .co m*/ import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONObject; public class JsonParser { public static List<Tweet> parseTwitterTimeline(String jsonString) { List<Tweet> tweets = new ArrayList<Tweet>(); try { Tweet tweet = null; JSONArray jsonArray = new JSONArray(jsonString); JSONObject jsonObject = null; JSONObject jsonUserObject = null; for (int a = 0; a < jsonArray.length(); a++) { tweet = new Tweet(); tweets.add(tweet); jsonObject = jsonArray.getJSONObject(a); jsonUserObject = jsonObject.getJSONObject("user"); tweet.setUserImage(jsonUserObject.optString("profile_image_url")); tweet.setUserName(jsonUserObject.optString("name")); tweet.setTweet(jsonObject.optString("text")); tweet.setUrl(jsonObject.optString("created_at")); tweet.setId(jsonObject.optString("id_str")); } } catch (Exception e) { } return tweets; } }