listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
if(position == 1 ){
Toast.makeText(getApplicationContext(),
"Click ListItem Number " + position,
Toast.LENGTH_LONG)
.show();
}else{
}
i have a list view from a custom adapter that works fine and when i click an item it gets the correct position. how can i exract a field views text out of the position. ie
holder.txtDesc = (TextView) convertView.findViewById(R.id.desc);
i want to target the desc field out of the position listem that i clicked.. i know you can use hash mapping but is there a way to just target a field view on item click by its list position? I know this is "webby" but I am sure java has the same flexibility
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
RowItem rowItem = getItem(position);
LayoutInflater mInflater = (LayoutInflater) context
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
convertView = mInflater.inflate(R.layout.list_item, null);
holder = new ViewHolder();
holder.txtDesc = (TextView) convertView.findViewById(R.id.desc);
holder.txtTitle = (TextView) convertView.findViewById(R.id.title);
convertView.setTag(holder);
} else
holder = (ViewHolder) convertView.getTag();
holder.txtDesc.setText(rowItem.getDesc());
holder.txtTitle.setText(rowItem.getTitle());
return convertView;
}