title: Single adapter for multiple recyclerview
body: <p>I wanted to use a single adapter for multiple RecyclerView sharing the same layout design. I made a custom class which includes my 3 ArrayList for text, picture and audio and I am inserting resources from different fragments in my custom class.</p>
  
  <p>Adapter Class:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>package com.example.adil.tabpen;
  
  import android.media.MediaPlayer;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.Button;
  import android.widget.ImageButton;
  import android.widget.ImageView;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.example.adil.tabpen.Fragment.TwoFragment;
  import com.example.adil.tabpen.OurData;
  
  /**
   * Created by Adil on 10/2/2017.
   */
  
  public class ListAdapter extends RecyclerView.Adapter {
      MediaPlayer mediaPlayer;
      @Override
      public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
      {
          View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
          return new ListViewHolder(view);
      }
  
      @Override
      public void onBindViewHolder(RecyclerView.ViewHolder holder, int position)
      {
          ((ListViewHolder) holder).bindView(position);
      }
  
      @Override
      public int getItemCount() {
          return OurData.title.size();
      }
  
      private class ListViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener
      {
          private TextView text;
          private ImageView image;
          private ImageButton button;
  
          public ListViewHolder(View itemview)
          {
              super(itemview);
              text = (TextView) itemview.findViewById(R.id.textF);
              image = (ImageView) itemview.findViewById(R.id.imageF);
              button = (ImageButton) itemview.findViewById(R.id.button);
              itemview.setOnClickListener(this);
          }
  
          public void bindView(final int position)
          {
              text.setText(OurData.title.get(position));
              image.setImageResource(OurData.pic.get(position));
              button.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v)
                  {
                      mediaPlayer = MediaPlayer.create(v.getContext(), OurData.record.get(position));
                      mediaPlayer.start();
                  }
              });
          }
  
          public void onClick (View view)
          {
  
          }
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>1st Fragment (small letter):  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>package com.example.adil.tabpen.Fragment;
  
  import android.app.FragmentTransaction;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.ListFragment;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.AdapterView;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  import android.widget.Toast;
  
  import com.example.adil.tabpen.Adapter;
  import com.example.adil.tabpen.ListAdapter;
  import com.example.adil.tabpen.OurData;
  import com.example.adil.tabpen.R;
  
  import java.util.ArrayList;
  
  /**
   * A simple {@link Fragment} subclass.
   */
  public class OneFragment extends Fragment
  {
      public OneFragment() {
          // Required empty public constructor
      }
      ListView listView;
      ArrayList&lt;String&gt; players;
      ArrayList&lt;Integer&gt; images;
  
      //String [] players = {"Tamim","Shakib","Mashrafe","Ashraful"};
      //int [] images = {R.drawable.a,R.drawable.b,R.drawable.c,R.drawable.a};
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
      {
          // Inflate the layout for this fragment
          View view =  inflater.inflate(R.layout.fragment_one, container, false);
  
          //Built-in adapter
          /*String[] menuItem = {"Hello","Hi","Bye"};
          ListView listView = (ListView) view.findViewById(R.id.listView);
          ArrayAdapter&lt;String&gt; listViewAdapter = new ArrayAdapter&lt;String&gt;(
                  getActivity(),
                  android.R.layout.simple_list_item_1,
                  menuItem
          );
          listView.setAdapter(listViewAdapter);*/
  
          //Custom adapter
          /*listView = (ListView) view.findViewById(R.id.listView);
          players = new ArrayList&lt;String&gt;();
          images = new ArrayList&lt;Integer&gt;();
  
          players.add("Ashraful");
          images.add(R.drawable.a);
          players.add("Aftab");
          images.add(R.drawable.a);
          players.add("Tamim");
          images.add(R.drawable.a);
          Adapter adapter = new Adapter(getActivity(),players,images);
          listView.setAdapter(adapter);
          listView.setOnItemClickListener(new AdapterView.OnItemClickListener()
          {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
                  Toast.makeText(getActivity(),players.get(position), Toast.LENGTH_SHORT).show();
              }
          });*/
          //Using recycleview
          OurData ourData = new OurData();
          ourData.pic.add(R.drawable.aa);
          ourData.title.add("Ant");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.bb);
          ourData.title.add("Bat");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.cc);
          ourData.title.add("Cry");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.dd);
          ourData.record.add(R.raw.a);
          ourData.title.add("Dish");
  
          ourData.pic.add(R.drawable.ee);
          ourData.title.add("Elephant");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.ff);
          ourData.title.add("Fish");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.gg);
          ourData.record.add(R.raw.a);
          ourData.title.add("Goose");
  
          ourData.pic.add(R.drawable.hh);
          ourData.title.add("Hen");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.i);
          ourData.title.add("Ice-cream");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.jj);
          ourData.title.add("Jeep");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.kk);
          ourData.title.add("Kite");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.mm);
          ourData.title.add("Mother");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.nn);
          ourData.title.add("Nut");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.oo);
          ourData.record.add(R.raw.a);
          ourData.title.add("Orange");
  
          ourData.pic.add(R.drawable.pp);
          ourData.title.add("Price");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.qq);
          ourData.title.add("Quality");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.rr);
          ourData.title.add("Rock");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.ss);
          ourData.title.add("Six");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.tt);
          ourData.title.add("Time");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.uu);
          ourData.title.add("Use");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.vv);
          ourData.record.add(R.raw.a);
          ourData.title.add("Via");
  
          ourData.pic.add(R.drawable.ww);
          ourData.title.add("Watch");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.xx);
          ourData.title.add("Xylophone");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.yy);
          ourData.title.add("Yolk");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.zz);
          ourData.title.add("Zebra");
          ourData.record.add(R.raw.a);
  
          RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.listRecyclerView);
          ListAdapter listAdapter = new ListAdapter();
          recyclerView.setAdapter(listAdapter);
          RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
          recyclerView.setLayoutManager(layoutManager);
          return view;
      }
  
  /*    private void onViewCreated()
      {
  
      }*/
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>2nd fragment (capital letter):</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>package com.example.adil.tabpen.Fragment;
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  import com.example.adil.tabpen.ListAdapter;
  import com.example.adil.tabpen.OurData;
  import com.example.adil.tabpen.R;
  
  /**
   * A simple {@link Fragment} subclass.
   */
  public class TwoFragment extends Fragment {
      public TwoFragment() {
          // Required empty public constructor
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          View view =  inflater.inflate(R.layout.fragment_two, container, false);
  
          OurData ourData = new OurData();
          ourData.pic.add(R.drawable.a);
          ourData.title.add("Apple");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.b);
          ourData.title.add("Ball");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.c);
          ourData.title.add("Cat");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.d);
          ourData.record.add(R.raw.a);
          ourData.title.add("Dog");
  
          ourData.pic.add(R.drawable.e);
          ourData.title.add("Egg");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.f);
          ourData.title.add("Flower");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.g);
          ourData.record.add(R.raw.a);
          ourData.title.add("Game");
  
          ourData.pic.add(R.drawable.h);
          ourData.title.add("Horse");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.i);
          ourData.title.add("Igloo");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.j);
          ourData.title.add("Jacket");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.k);
          ourData.title.add("Key");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.m);
          ourData.title.add("Mango");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.n);
          ourData.title.add("Net");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.o);
          ourData.record.add(R.raw.a);
          ourData.title.add("Owl");
  
          ourData.pic.add(R.drawable.p);
          ourData.title.add("Potato");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.q);
          ourData.title.add("Quit");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.r);
          ourData.title.add("Race");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.s);
          ourData.title.add("Shop");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.t);
          ourData.title.add("Tomato");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.u);
          ourData.title.add("Umbrella");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.v);
          ourData.record.add(R.raw.a);
          ourData.title.add("Vehicle");
  
          ourData.pic.add(R.drawable.w);
          ourData.title.add("Window");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.x);
          ourData.title.add("X-Ray");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.y);
          ourData.title.add("Yellow");
          ourData.record.add(R.raw.a);
  
          ourData.pic.add(R.drawable.z);
          ourData.title.add("Zoo");
          ourData.record.add(R.raw.a);
  
          RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.listRecyclerView);
          ListAdapter listAdapter = new ListAdapter();
          recyclerView.setAdapter((listAdapter));
          RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
          recyclerView.setLayoutManager(layoutManager);
  
          return view;
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>1st fragment includes small letters, audio and a pic. 2nd fragment includes capital letters, audio and pic. My code works fine but I think I messed something. When I run the code I get both capital and small letters in both fragments. But my goal is to have capital letters in capital letter fragment and small letters in small letters fragment. I am unable to find that where should I change.</p>