Android Open Source - AndroidGridImageSearch Image Result






From Project

Back to project page AndroidGridImageSearch.

License

The source code is released under:

MIT License

If you think the Android project AndroidGridImageSearch listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.julienlecomte.gridimagesearch;
/*ww  w  .ja v a  2s . c  o  m*/
import java.io.Serializable;
import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class ImageResult implements Serializable {
  private static final long serialVersionUID = 1L;
  private String fullUrl;
  private String thumbUrl;

  public ImageResult(JSONObject o) {
    try {
      fullUrl = o.getString("url");
      thumbUrl = o.getString("tbUrl");
    } catch (JSONException e) {
      fullUrl = null;
      thumbUrl = null;
    }
  }

  public String getFullUrl() {
    return fullUrl;
  }

  public String getThumbUrl() {
    return thumbUrl;
  }

  public String toString() {
    return "<img src=\"" + fullUrl + "\">";
  }

  public static ArrayList<ImageResult> fromJSONArray(JSONArray jsonResults) {
    ArrayList<ImageResult> results = new ArrayList<ImageResult>();
    for (int i = 0; i < jsonResults.length(); i++) {
      try {
        JSONObject o = jsonResults.getJSONObject(i);
        results.add(new ImageResult(o));
      } catch (JSONException e) {
        e.printStackTrace();
      }
    }
    return results;
  }
}




Java Source Code List

net.julienlecomte.gridimagesearch.EndlessScrollListener.java
net.julienlecomte.gridimagesearch.ImageDisplayActivity.java
net.julienlecomte.gridimagesearch.ImageResultArrayAdapter.java
net.julienlecomte.gridimagesearch.ImageResult.java
net.julienlecomte.gridimagesearch.SearchActivity.java
net.julienlecomte.gridimagesearch.SearchSettings.java
net.julienlecomte.gridimagesearch.SettingsActivity.java