Without the interface, everything worked. I redo the OnItemClickListener through the interface, and everything works until the order of items gets lost when sorting, for example, when searching for 20, the position becomes the first and is processed as the first one. in this case?
here is the interface:
public interface OnItemClickListener { void onItemClick(View view, int position); } here is the adapter:
@Override public void onClick(View v) { clickListener.onItemClick(v,getAdapterPosition()); } } void SetOnItemClickListener(final OnItemClickListener itemClickListener) { this.clickListener = itemClickListener; } вот сам фрагмент: public class Fragment_1extends Fragment implements SearchView.OnQueryTextListener,OnItemClickListener adapter.SetOnItemClickListener(this); @Override public void onItemClick(View view, int position) { Context context = view.getContext(); Intent i; i = new Intent(context, Detai.class); i.putExtra("pos2", StationList.get(position).getDetails_new()); context.startActivity(i); } and here's a class
public class ItemBusStation implements Serializable { private String details1; public ItemBusStation( String details1) { this.details1 = details1; } public String getDetails1() { return details1; }