TextView value changes back to previous value after scroll in base adapter

后端 未结 3 546
深忆病人
深忆病人 2021-01-27 02:58

I\'ve been researching this forever and can\'t find a solution. Everything about my custom list view seems to perform correctly. When I click on the holder.feedUpVoteButto

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-27 03:15

    Actually that is the whole theory.When you increment a value.You have to increment that value in the list from where you are fetching the data.Because when you scroll down,the upper rows will be lost.When you scroll back up,list will be loaded again from the list values.So all you have to do is to increment the value in the list too i.e GlobalFeedTab.arrayFeedList this link is for further detail,for anyone looking for some more detail When you write this line

    likes[pos] += 1;
    

    You will also have to increment the value in the arraylist(mFeed) of yours and then write notifyDataSetChanged();

提交回复
热议问题