1

I am working with the awesome endlessAdapter provided here: https://github.com/commonsguy/cwac-endless

Everything seems to work fine with the examples and I would like to work with my own layout, so as usual, I override the getview of my adapter:

public class EventAdapter extends EndlessAdapter {
@Override
    public View getView(int position, View convertView, ViewGroup parent) {

        EventHolder holder = null;
        if (convertView == null) {
            LayoutInflater layoutInflater = (LayoutInflater) ctxt
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = layoutInflater.inflate(R.layout.row_activite_light,
                    parent, false);

            holder = new EventHolder();
            holder.txtTitle = (TextView) convertView
                    .findViewById(R.id.txttitle);

            convertView.setTag(holder);

        } else {
            holder = (EventHolder) convertView.getTag();
        }

        holder.txtTitle.setText(mListItems.get(position).getTitle());


        return convertView;
    }
}

This is fine, but I have lost the ability to load the next batch of data.

Can someone explain how I should work with the getView of the adapter?

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
Waza_Be
  • 39,407
  • 49
  • 186
  • 260

1 Answers1

3

Everything seems to work fine with the examples and I would like to work with my own layout, so as usual, I override the getview of my adapter

Override getView() of the adapter you are wrapping in EndlessAdapter (i.e., the one you supplied to the EndlessAdapter constructor).

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • @Waza_Be: No. Somewhere in your code, you have a statement like `new EndlessAdapter(thisIsMyRealAdapter)`. `thisIsMyRealAdapter` is some Java object, implementing `ListAdapter`. More importantly, the Java class for `thisIsMyRealAdapter` is **something you wrote**. Override `getView()` in *that* class. – CommonsWare Oct 14 '12 at 14:55