public override View GetView(int position, View convertView, ViewGroup parent)
This method is not called even if the count is greater than zero.
I want to know the exact behavior of GridView and BaseAdapter.
I tried as much as possible but the GetView method is not triggered.
Code Snippet:
internal class SymbolAdapter : BaseAdapter
{
private object[] m_items;
internal SymbolAdapter(Context context, Object[] items) : base()
{
this.context = context;
m_items = items;
}
public override int Count
{
get
{
return m_items.Count;
}
}
public override Java.Lang.Object GetItem(int position)
{
return null;
}
public override long GetItemId(int position)
{
return 0;
}
public override View GetView(int position, View convertView, ViewGroup parent)
{
View view = null;
object item = m_items[position];
if (convertView == null)
{
ImageView imageView = new ImageView(context);
imageView.LayoutParameters = new AbsListView.LayoutParams(85, 85);
imageView.SetScaleType(ImageView.ScaleType.CenterCrop);
imageView.SetPadding(8, 8, 8, 8);
view = imageView;
}
else
view = convertView;
return view;
}
}
Please help me.
The issue resolved when i tried to add the view prior to creating the instance for BaseAdapter to the Adapter property of the GridView.
Thanks,