Cannot resolve method getcontext() or getItem()

Asked

Viewed 246 times

-1

Hi,

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

inserir a descrição da imagem aqui

1 answer

1

Your Listadapter class 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 look if this helps: Arrayadapter

Browser other questions tagged

You are not signed in. Login or sign up in order to post.