I am using a RecyclerView
in order to show a list of different items. The problem is that on fast scroll items are being randomly generated empty, if i scroll up and down again a different item can be generated empty. It happens on my LG g2 and I've checked on LG g4 and it does not happens there.
This is what i mean by empty item:
This is my onBindViewHolder
in my adapter:
@Override
public void onBindViewHolder(ViewHolder viewHolder, int position) {
final int finalPosition = viewHolder.getAdapterPosition();
final String url = results.get(finalPosition).getURL();
viewHolder.tvUrl.setText(url.replaceFirst("^(http://|www\\.|http://|www\\.|https://)", ""));
viewHolder.tvCopiedWords.setText(String.format(Locale.getDefault(), "%1$d", results.get(finalPosition).getNumberOfCopiedWords()));
viewHolder.tvPercents.setText(String.format(Locale.getDefault(), "%1$d%%", results.get(finalPosition).getPercents()));
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent i = new Intent(activity, ResultWebViewActivity.class);
i.putExtra("url", url);
i.putExtra("Process", process);
i.putExtra("share", activity.getString(R.string.export_scan) + ":" + System.getProperty("line.separator")
+ url + System.getProperty("line.separator")
+ activity.getString(R.string.results_similarity, results.get(finalPosition).getPercents()) + System.getProperty("line.separator")
+ activity.getString(R.string.results_copied_words, results.get(finalPosition).getNumberOfCopiedWords()));
activity.startActivity(i);
}
});
}
If you need another piece of code in order to help comment it and I will add.
Any ideas?