As mentioned in topic. There is Base adapter implementation for GridView
where during debug we can see that onItemClick
is called with proper values like here:
... and just after this call is getView
from BaseAdapter
implementation which is called with:
There may be no dependency between these two, but anyway clicking on different elements on GridView
should return different position values.
if convertView != null
then convertView.getId();
returns -1 .
Any ideas appreciated.
EDIT:
This is from adapter:
public GridImageAdapter(Context context, ArrayList<TileWidget> tileWidgetList) {
this.context = context;
this.tileWidgetList = tileWidgetList;
}
@Override
public int getCount() {
return tileWidgetList.size();
}
@Override
public Object getItem(int position) {
TileWidget tw = tileWidgetList.get(position);
return tw;
}
@Override
public long getItemId(int position) {
return position;
}
The value returned by
public long getItemId(int position)
is ok.
EDIT:
Just debugged that is returns good position
values when it is initialized. So the zero'es
are only onClick results.