Can not resolve method getContext () or getItem () [closed]

-1

Hi,

Trying to pass the data of an ArrayList, but the error appears in the methods

    
asked by anonymous 15.04.2017 / 20:46

1 answer

1

Your class ListAdapter needs to extend ArrayAdapter<Item> .

Example:

public class ListAdapter extends ArrayAdapter<Item> {

    public ListAdapter(Context context, int textViewResourceId) {
        super(context, textViewResourceId);
    }

    public ListAdapter(Context context, int resource, List<Item> items) {
        super(context, resource, items);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        View v = convertView;

        if (v == null) {
            LayoutInflater vi;
            vi = LayoutInflater.from(getContext());
            v = vi.inflate(R.layout.itemlistrow, null);
        }



        return v;
    }

}

Take a peek if this helps: ArrayAdapter

    
15.04.2017 / 20:54