title: Use same RecyclerViewAdapter for 2 RecyclerView's
body: <p>i'm having some issues on implementing 2 <code>RecyclerView's</code> to the same <code>RecyclerViewAdapter</code> actually in my <code>main.class</code> i have 2 <code>RecyclerView's</code> one work's properly and it's made of <strong>buttons</strong> that contain some strings and i have also another <code>RecyclerView</code> where i would be able to put the string data from the <strong>buttons</strong> <code>onClick</code> but i can't get how can i implement another <code>RecyclerView</code> to <code>RecyclerViewAdapter</code> i have yet the <code>onClick</code> method on buttons so i have just to get data from them and put them to the new <code>RecyclerView</code> but i don't know how to do it.</p>
  
  <p>Any suggestion on how can i do?</p>
  
  <p>Here is the screenshot of my layout with two <code>recyclerView's</code></p>
  
  <p><a href="https://i.stack.imgur.com/HnA1q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HnA1q.png" alt="enter image description here"></a></p>
  
  <p>While here is the code from the <code>RecyclerViewAdapter</code> the second <code>recyclerView</code> to implement is called recyclerlist_item.xml and it contain 3 TextView's called "Desc,Qta,Imp"</p>
  
  <pre><code>public class Adapter extends RecyclerView.Adapter&lt;Adapter.ViewHolder&gt; {
  
      private ArrayList&lt;Item&gt; mArrayList;
      private OnItemClickListener mListener;
  
      public interface  OnItemClickListener{
          void onItemClick(int position);
      }
  
      public void setOnItemClickListener(OnItemClickListener listener){
          mListener = listener;
      }
  
      public static class ViewHolder extends RecyclerView.ViewHolder{
  
          public TextView mTextView;
  
          public ViewHolder(View itemView, final OnItemClickListener listener) {
              super(itemView);
              mTextView = itemView.findViewById(R.id.ButtonName);
  
  
              itemView.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      if(listener != null){
                          int position = getAdapterPosition();
                          if(position != RecyclerView.NO_POSITION){
                              listener.onItemClick(position);
                          }
                      }
                  }
              });
  
          }
      }
  
  
  public static class ListHolder extends  RecyclerView.ViewHolder{
  
          public TextView desc;
          public TextView qta;
          public TextView imp;
  
  
      public ListHolder(View listView) {
          super(listView);
  
          desc = listView.findViewById(R.id.Desc);
          qta = listView.findViewById(R.id.Qta);
          imp = listView.findViewById(R.id.Imp);
  
  
      }
  
  
  }
  
      public Adapter(ArrayList&lt;Item&gt; itemList){
              mArrayList = itemList;
      }
  
      @NonNull
      @Override
      public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item, parent, false);
          ViewHolder viewHolder = new ViewHolder(v, mListener);
          return viewHolder;
      }
  
      @Override
      public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
                  Item currentItem = mArrayList.get(position);
  
                  holder.mTextView.setText(currentItem.getBtnName());
      }
  
      @Override
      public int getItemCount() {
          return mArrayList.size();
      }
  }
  </code></pre>