performance - Items in RecyclerView collapse when scrolling too fast back and forth -
i have app retrieves data database. data displayed in 2 fragments instantiated mainactivity via viewpager. both fragments contain single recyclerview.
when scrolling recyclerviews very fast (back , forth) structure of list items collapses.
@override public void onbindviewholder(matchviewholder holder, int position) { mgames.movetoposition(position); string hometeam = mgames.getstring(mgames.getcolumnindex(dbcontract.teamentry.alias_home_team)); string awayteam = mgames.getstring(mgames.getcolumnindex(dbcontract.teamentry.alias_away_team)); int homescore = mgames.getint(mgames.getcolumnindex(dbcontract.gameentry.column_home_score)); int awayscore = mgames.getint(mgames.getcolumnindex(dbcontract.gameentry.column_away_score)); string datestring = mgames.getstring(mgames.getcolumnindex(dbcontract.gameentry.column_date)); simpledateformat fromformat = new simpledateformat(dbcontract.sql_date_format, locale.english); try { date date = fromformat.parse(datestring); simpledateformat toformat = new simpledateformat("hh:mm - d mmm yyyy"); datestring = toformat.format(date); } catch (parseexception e) { e.printstacktrace(); } holder.listitemhometeam.settext(hometeam); holder.listitemhomescore.settext(0 <= homescore ? string.valueof(homescore) : ""); holder.listitemawayteam.settext(awayteam); holder.listitemawayscore.settext(0 <= awayscore? string.valueof(awayscore) : ""); holder.listitemdate.settext(datestring); holder.listitemhomelogo.setimageresource(resourceutils.getlogoresource(mgames.getint(mgames.getcolumnindex(dbcontract.teamentry.alias_home_id)))); holder.listitemawaylogo.setimageresource(resourceutils.getlogoresource(mgames.getint(mgames.getcolumnindex(dbcontract.teamentry.alias_away_id)))); }
Comments
Post a Comment