Question

I am having a Custom List view with Section Header.

Note: this is not ordinary list. It's a Section Header.

Custom List is as follows:

Custom List

enter image description here

Before clicking the like image it looks like Image 1 and after click it should changed like Image 2.

My problem is that:

  1. It looks very strange if I click on the like image of particular row Like image in others rows get changed.

  2. Some times it throws Null Pointer exception if i click 1st row of the list.

What I need is that if I click on the Like image of particular list it state or color only change, others should keep unchanged.

Main Activty link

List_Data

Custom List

I tried with this link but it doesn't help me.

Since it is Sectioned header, Adapter calculates the Header also as row so the size of list includes the Header also. Make a notes in this also.

Was it helpful?

Solution

try this. for click listener

holder.like_icon.setOnClickListener(new OnClickListener(){ 

@Override 
public void onClick(View arg0) { 
ViewHolder VH = (ViewHolder)convertView.getTag(); 
VH.like_icon.setBackgroundResource(android.R.drawable.btn_star_big_on); 

} 
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top