Android Open Source - KangarooImageSearch Image Data Adapter

From Project

Back to project page KangarooImageSearch.


The source code is released under:

MIT License

If you think the Android project KangarooImageSearch 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 com.nickrasband.kangarooimagesearchv2;
/* ww w  .  j  a v a2s.  c  om*/
import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;


 * This adapter is in charge of updating individual smart image views inside of the GridView
 * holding all of the image search results.
 * @author Nik Rasband
public class ImageDataAdapter extends ArrayAdapter<ImageData> {
  public ImageDataAdapter(Context context, ArrayList<ImageData> images) {
    super(context, R.layout.image_data_view, images); 
  public View getView(int position, View convertView, ViewGroup parent) {
    // Get data.
    ImageData data = getItem(position);
    SmartImageView view = (SmartImageView)convertView;
    // If the convertView is null, we need to create the view for the first time,
    // otherwise, we can reuse the existing view.
    if (view == null) {
      LayoutInflater inflater = LayoutInflater.from(getContext());
      view = (SmartImageView)inflater.inflate(R.layout.image_data_view, parent, false);
    else {
    // Update the image by setting its url.
    return view;

Java Source Code List