package demo.example.com.customarrayadapter;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

public class AndroidFlavorAdapter extends ArrayAdapter<AndroidFlavor> {
    private static final String LOG_TAG = AndroidFlavorAdapter.class.getSimpleName();

    public AndroidFlavorAdapter(Activity context, List<AndroidFlavor> androidFlavors)
    {
        super(context, 0, androidFlavors);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        AndroidFlavor androidFlavor = getItem(position);
        View rootView = LayoutInflater.from(getContext()).inflate(R.layout.list_item_flavor, parent, false);

        ImageView iconView = (ImageView) rootView.findViewById(R.id.list_item_icon);
        iconView.setImageResource(androidFlavor.image);

        TextView versionNameView = (TextView) rootView.findViewById(R.id.list_item_version_name);
        versionNameView.setText(androidFlavor.versionName);

        TextView versionNumberView = (TextView) rootView.findViewById(R.id.list_item_versionnumber_textview);
        versionNumberView.setText(androidFlavor.versionNumber);
        return rootView;
    }
}

@@ -442,24 +442,422 @@
 pleName();%0A%0A
+    /**%0A     * This is our own custom constructor (it doesn't mirror a superclass constructor).%0A     * The context is used to inflate the layout file, and the List is the data we want%0A     * to populate into the lists%0A     *%0A     * @param context        The current context. Used to inflate the layout file.%0A     * @param androidFlavors A List of AndroidFlavor objects to display in a list%0A     */%0A
     public A
@@ -933,154 +933,1060 @@
 ors)
+ %7B
 %0A    
-%7B%0A        super(context, 0, androidFlavors);%0A    %7D%0A%0A    @Override%0A    public View getView(int position, View convertView, ViewGroup parent) %7B
+    // Here, we initialize the ArrayAdapter's internal storage for the context and the list.%0A        // the second argument is used when the ArrayAdapter is populating a single TextView.%0A        // Because this is a custom adapter for two TextViews and an ImageView, the adapter is not%0A        // going to use this second argument, so it can be any value. Here, we used 0.%0A        super(context, 0, androidFlavors);%0A    %7D%0A%0A    /**%0A     * Provides a view for an AdapterView (ListView, GridView, etc.)%0A     *%0A     * @param position    The AdapterView position that is requesting a view%0A     * @param convertView The recycled view to populate.%0A     *                    (search online for %22android view recycling%22 to learn more)%0A     * @param parent The parent ViewGroup that is used for inflation.%0A     * @return The View for the position in the AdapterView.%0A     */%0A    @Override%0A    public View getView(int position, View convertView, ViewGroup parent) %7B%0A        // Gets the AndroidFlavor object from the ArrayAdapter at the appropriate position
 %0A   

Add comments to custom array adapter.