I'm using LazyAdaptor to create a listview with some data I'm parsing from a web server. Each row has a ImageView that is acting like a button and what I'm trying to do when the ImageView is clicked it will retrieve a value in the row named "reference". I'm trying to just Toast it as a quick way to make sure I'm grabbing the correct reference ID. I added a OnClick method and was able to retrieve the "position" but not sure how to grab the reference ID. Any help would be appreciated.
public View getView(int position, View convertView, ViewGroup parent) {
View vi = convertView;
RowHolder holder = null;
if (convertView == null) {
vi = inflater.inflate(R.layout.group_view, null);
holder = new RowHolder();
holder.reference = (TextView) vi.findViewById(R.id.reference);
holder.name = (TextView) vi.findViewById(R.id.name);
holder.vicinity = (TextView) vi.findViewById(R.id.vicinity);
holder.checkin = (ImageView) vi.findViewById(R.id.check_in);
vi.setTag(holder);
} else {
holder = (RowHolder) vi.getTag();
}
HashMap<String, String> placeList = new HashMap<String, String>();
placeList = data.get(position);
holder.reference.setText(placeList.get(MainActivity.KEY_REFERENCE));
holder.name.setText(placeList.get(MainActivity.KEY_NAME));
holder.vicinity.setText(placeList.get(MainActivity.KEY_VICINITY));
holder.checkin.setTag(position);
holder.checkin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(activity, v.getTag().toString(), Toast.LENGTH_SHORT).show();
}
});
return vi;
}