Back to project page android-grid-image-search.
The source code is released under:
MIT License
If you think the Android project android-grid-image-search 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.gemmakbarlow.gridimagesearch.model; // w ww. j av a2 s .co m import java.io.Serializable; import java.util.ArrayList; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; // TODO Things remaining to implement // Smoothie (see Github) - Async pagination on a GridView // No pagination has been added yet // Filters - size, color, type, site restriction public class ImageResult implements Serializable { private static final long serialVersionUID = 2578540597849123970L; private String fullUrl; private String thumbUrl; // Constructor public ImageResult(JSONObject json) { try { this.fullUrl = json.getString("url"); this.thumbUrl = json.getString("tbUrl"); } catch (JSONException e) { this.fullUrl = null; this.thumbUrl = null; } } // Getters / Setters public String getFullUrl() { return fullUrl; } public void setFullUrl(String fullUrl) { this.fullUrl = fullUrl; } public String getThumbUrl() { return thumbUrl; } public void setThumbUrl(String thumbUrl) { this.thumbUrl = thumbUrl; } // Description public String toString() { return this.fullUrl; } public static ArrayList<ImageResult> fromJSONArray( JSONArray imageJsonResults) { ArrayList<ImageResult> results = new ArrayList<ImageResult>(); for(int i=0; i<imageJsonResults.length(); i++) { try { results.add(new ImageResult(imageJsonResults.getJSONObject(i))); } catch(JSONException e) { } } return results; } // Other }