title: RecyclerView search filter getting wrong position
body: <p>i use RecyclerView and i made filter on it and i have problem</p>
  
  <p>after i search when i press on item i get wrong position not one i searched it please help me to solve this problem</p>
  
  <h2>RecyclerView Adapter</h2>
  
  <pre><code>public class RecyclerViewAdapter extends RecyclerView.Adapter&lt;RecyclerViewAdapter.ViewHolder&gt; {
  
  Context context;
  List&lt;listitem_gib&gt; getDataAdapter;
  
  
  
  public RecyclerViewAdapter(List&lt;listitem_gib&gt; getDataAdapter, Context context){
  
      super();
  
      this.getDataAdapter = getDataAdapter;
      this.context = context;
  
  }
  
  @Override
  public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  
      View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.cardview_layout, parent, false);
  
      ViewHolder viewHolder = new ViewHolder(v,context,getDataAdapter);
  
      return viewHolder;
  }
  
  @Override
  public void onBindViewHolder(final ViewHolder holder, final int position) {
  
      listitem_gib getDataAdapter1 =  getDataAdapter.get(position);
  
      holder.name.setText(getDataAdapter1.getName());
      holder.num.setText(getDataAdapter1.getnum());
      Picasso.with(context).load("http://i-geeky.info/android/image/" + getDataAdapter1.getimg()).into(holder.img1);
  
  
  }
  
  @Override
  public int getItemCount() {
  
      return getDataAdapter.size();
  }
  
  class ViewHolder extends RecyclerView.ViewHolder
              implements View.OnClickListener{
  
      public TextView name;
      public TextView num;
      public ImageView img1;
  
      ImageButton fav;
  
      Context context;
      List&lt;listitem_gib&gt; getDataAdapter;
  
  
      public ViewHolder(View itemView, Context context ,List&lt;listitem_gib&gt; getDataAdapter ) {
  
          super(itemView);
          itemView.setOnClickListener(this);
          this.getDataAdapter = getDataAdapter;
          this.context = context;
          this.fav= (ImageButton) itemView.findViewById(R.id.btn_fav);
  
          name = (TextView) itemView.findViewById(R.id.Main_Text) ;
          num = (TextView) itemView.findViewById(R.id.Second_Text) ;
          img1 = (ImageView) itemView.findViewById(R.id.img1) ;
  
      }
  
  
      @Override
      public void onClick(View v) {
  
          int position = getAdapterPosition();
          listitem_gib getDataAdapter =this.getDataAdapter.get(position);
          Intent intent = new Intent(this.context,Rewaya_info.class);
          intent.putExtra("name",getDataAdapter.getName());
          intent.putExtra("url",getDataAdapter.geturl());
          intent.putExtra("img",getDataAdapter.getimg());
          intent.putExtra("num",getDataAdapter.getnum());
          intent.putExtra("size",getDataAdapter.getsize());
          this.context.startActivity(intent);
  
      }
  }
  public void setFilter(List&lt;listitem_gib&gt; newList)
  {
      getDataAdapter = new ArrayList&lt;&gt;();
      getDataAdapter.addAll(newList );
      notifyDataSetChanged();
  }}
  </code></pre>
  
  <h2>Activity</h2>
  
  <pre><code>@Override
  public boolean onQueryTextChange(String newText) {
  
      newText = newText.toLowerCase();
      List&lt;listitem_gib&gt; newList = new ArrayList&lt;&gt;();
      for (listitem_gib list : GetDataAdapter1){
          String name = list.getName().toLowerCase();
          String name1 = list.getnum().toLowerCase();
  
          if (name.contains(newText) || name1.contains(newText)){
              newList.add(list);
          }
      }
      recyclerViewadapter.setFilter(newList);
      return true;
  }
  </code></pre>