// Path: ListView/app/src/main/java/qa/edu/qu/cse/cmps497/listview/model/Item.java
// public class Item {
// 
//     private int number;
//     private String name;
// 
//     public Item(int number, String name) {
//         this.number = number;
//         this.name = name;
//     }
//     public int getNumber() {
//         return number;
//     }
// 
//     public void setNumber(int number) {
//         this.number = number;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
// 
// }


import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.List;
import qa.edu.qu.cse.cmps497.listview.R;
import qa.edu.qu.cse.cmps497.listview.model.Item;
package qa.edu.qu.cse.cmps497.listview.adapter;




public class ListAdapter extends ArrayAdapter<Item> {


    /**
     * SuperClass method that you must overwrite. This method is called
     * in setAdapter on the ListView object
     * @param resource is the resource layout ID of your custom row.
     * @param items Are the list of items in a List format (Model)
     */
    public ListAdapter(Context context, int resource, List<Item> items) {
        super(context, resource, items);
    }

    /**
     * Must overwrite this method. Return a view of each row
     * @param position the position of the item you are drawing
     * @param convertView the view you are inflating into
     * @param parent parent view (if any)
     * @return return the row item view to display in the list
     */
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        if (convertView == null) {
            Log.i("TAG", "View is null");
            LayoutInflater vi = LayoutInflater.from(getContext());
            convertView = vi.inflate(R.layout.listview_row_item_custom, parent, false);
        }

        //getItem() is a super class method that retrieves the item that corresponds to this row
        //of this listView
// Path: ListView/app/src/main/java/qa/edu/qu/cse/cmps497/listview/model/Item.java
// public class Item {
// 
//     private int number;
//     private String name;
// 
//     public Item(int number, String name) {
//         this.number = number;
//         this.name = name;
//     }
//     public int getNumber() {
//         return number;
//     }
// 
//     public void setNumber(int number) {
//         this.number = number;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
// 
// }


// Path: ListView/app/src/main/java/qa/edu/qu/cse/cmps497/listview/adapter/ListAdapter.java
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.List;
import qa.edu.qu.cse.cmps497.listview.R;
import qa.edu.qu.cse.cmps497.listview.model.Item;

package qa.edu.qu.cse.cmps497.listview.adapter;




public class ListAdapter extends ArrayAdapter<Item> {


    /**
     * SuperClass method that you must overwrite. This method is called
     * in setAdapter on the ListView object
     * @param resource is the resource layout ID of your custom row.
     * @param items Are the list of items in a List format (Model)
     */
    public ListAdapter(Context context, int resource, List<Item> items) {
        super(context, resource, items);
    }

    /**
     * Must overwrite this method. Return a view of each row
     * @param position the position of the item you are drawing
     * @param convertView the view you are inflating into
     * @param parent parent view (if any)
     * @return return the row item view to display in the list
     */
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        if (convertView == null) {
            Log.i("TAG", "View is null");
            LayoutInflater vi = LayoutInflater.from(getContext());
            convertView = vi.inflate(R.layout.listview_row_item_custom, parent, false);
        }

        //getItem() is a super class method that retrieves the item that corresponds to this row
        //of this listView
        Item p = getItem(position);