Skip to content Skip to sidebar Skip to footer

Button Onclick Get Wrong Position In Viewholder Patterned Listview

I have a button inside the row of the listview. I want to detect its onClick event and position on the row (which row is clicked). My current code is working, but it fires on the w

Solution 1:

Declare

 LayoutInflater mInflater;  //Global   

Call this

mInflater = LayoutInflater.from(context); //Contractor 

Then

if (convertView == null)
 convertView = mInflater.inflate(R.layout.item_cart, null);

Solution 2:

Well,

I just need to call notifyDataSetChanged

So I get rid of this code :

holder.txtCartQty.setText(getItem(position).getQty());

and called notifyDataSetChanged instead

My mistake is i tried to update the holder manually and forgot one of the most basic principle of Android adapter

Thanks all for the help

Post a Comment for "Button Onclick Get Wrong Position In Viewholder Patterned Listview"