When the activity initially loaded reqcycler view all items loaded succesfully but on scrolling from up to down some data get lossed and not displayed as items. if i continue to scroll up and down it agian come back. how to fix this problem.
This is my on (bindviewholder) method code.
public void onBindViewHolder(CustomViewholder holder, int position) {
JSONObject jsonObject=null;
if(arrayList!=null) {
try {
jsonObject=new JSONObject(arrayList.get(position));
if(!jsonObject.getString("id").equals(id)){
holder.textView.setText(jsonObject.getString("username"));
Picasso.with(getActivity()).load(jsonObject.getString("profile")).resize(100, 100).into(holder.imageView);
// Toast.makeText(getActivity(),"id was equal",Toast.LENGTH_LONG).show();
}else {
holder.v.setVisibility(View.GONE);
holder.v.setLayoutParams(new RecyclerView.LayoutParams(0, 0));
}
} catch (JSONException e) {
e.printStackTrace();
}
}else{
holder.textView.setText("no data");
}
}