In your CustomAdapter.class add this code
public View getView(final int position, View convertView, final ViewGroup parent) {
ViewHolder holder = new ViewHolder();
holder.txtDetails = (TextView) vi.findViewById(R.id.txt_expenses_details);
holder.txtDetails.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((ListView) parent).performItemClick(v, position, 0);
}
});
vi.setTag(holder);
return vi;
}
In your MainActivity.class
click textview and change value
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
long viewId = view.getId();
if (viewId == R.id.txt_expenses_details) {
((TextView)view).setText("Hey, I've just been tapped on!");
customListAdapter.notifyDataSetChanged();
}
}
});
Click listview and change value
(or)
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
TextView tv = (TextView) view.findViewById(R.id.txt_expenses_details);
tv.setText(...);
customListAdapter.notifyDataSetChanged();
}
});
position
you refer to the position of the view inside a list view ? – Akimbo