Home > Mobile > Adapter space and asynchronous data binding
Adapter space and asynchronous data binding
Time:11-23
Recycleview textview, textview value through the adapter onbindviewholder okhttp asynchronous method to obtain, but there will be disorder, avatars and username inconsistent problems, (blind guess may control no binding, assigned to the other textview) How to solve
CodePudding user response:
This is generally get to reproduce the data into the list first
CodePudding user response:
Reason: Control reuse, because it is asynchronous operations, leading to a network request textView set after the completion of the content is updated, asynchronous without order, easily disorder, Solution: . Pass in the adapter textView setTag (position), tag set the current position, in the network request is completed, again through the int currentPosition=(int) textView. GetTag (), to determine whether the position is equal to the currentPosition, if equal setText (" XXXX "), or reuse description this position by other items, at this time is no longer display, assignment can no longer,