3

How do you do the following i MonoDroid?

public class ItemListAdapter : BaseAdapter    
{
    IEnumerable<Item> items;

    public override Java.Lang.Object GetItem(int position)
            {
                items.ElementAt(position);
            }
}

The problem is that I need to override the GetItem() because I subclass the BaseAdapter, but obviously the above causes compiler error.

Any ideas?

Prince John Wesley
  • 62,492
  • 12
  • 87
  • 94
Nicklas Møller Jepsen
  • 1,248
  • 2
  • 16
  • 34

2 Answers2

6

Make "Item" be a subclass of Java.Lang.Object.

jpobst
  • 9,982
  • 1
  • 29
  • 33
1

items.ElementAt(position).JavaCast< Java.Lang.Object >();

samus
  • 6,102
  • 6
  • 31
  • 69