title: Do I need to create adapter for every recyclerview
body: <p>I am a beginner to android programming. I have created a recycler view which parses data from a JSON. I want to parse another JSON data which has the same data type and same layout everything but it is a different category. do I need to make another adapter for this recycler view?or i can use the same adapter,how i can use? Please help. </p>
  
  <p>My Fragment Code</p>
  
  <pre><code>public class Tab1 extends Fragment implements ExampleAdapter.onItemClickListener{
      private RecyclerViewPager mRecyclerView;
      private ExampleAdapter mExampleAdapter;
      private ArrayList&lt;ExampleItem&gt; mExampleList;
      private RequestQueue mRequestQueue;
      public static final String EXTRA_URL = "imageUrl";
  
      @Nullable
      @Override
      public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          ((AppCompatActivity) getActivity()).getSupportActionBar().hide();
          View rootView = inflater.inflate(R.layout.tab1, container, false);
          mRecyclerView = rootView.findViewById(R.id.recycler_view);
          mRecyclerView.setHasFixedSize(true);
  
          mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
          mExampleList = new ArrayList&lt;&gt;();
          mRequestQueue = Volley.newRequestQueue(getActivity().getApplicationContext());
  
          // Set the adapter here.
          // Use getActivity() instead of getContext()
          parseJson();
          mExampleAdapter = new ExampleAdapter(getContext(), mExampleList);
          mRecyclerView.setAdapter(mExampleAdapter);
          mExampleAdapter.setOnItemClickListener(Tab1.this);
          return rootView;
      }
  
      private void parseJson() {
          String url = "http://maranamassapp.cf/json_getdata.php";
          JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null,
                  new Response.Listener&lt;JSONObject&gt;() {
                      @Override
                      public void onResponse(JSONObject response) {
                          try {
                              JSONArray jsonArray = response.getJSONArray("server_response");
                              for (int i = 0; i &lt; jsonArray.length(); i++) {
                                  JSONObject ser = jsonArray.getJSONObject(i);
                                  String creatorname =  ser.getString("head");
                                  String imageUrl = ser.getString("image");
                                  String cat = ser.getString("content");
                                  String postdate = ser.getString("weburl");
                                  String dateall = ser.getString("date");
                                  mExampleList.add(new ExampleItem(imageUrl,creatorname,cat,postdate,dateall));
                              }
  
                              // Just call notifyDataSetChanged here
                              mExampleAdapter.notifyDataSetChanged();
                          } catch (JSONException e) {
                              e.printStackTrace();
                          }
                      }
                  }, new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {
                  error.printStackTrace();
              }
          });
  
          mRequestQueue.add(request);
      }
          public void onItemClick(int position) {
              Intent detailintent = new Intent(getContext(), DetailActivity.class);
              ExampleItem clickeditem = mExampleList.get(position);
              detailintent.putExtra(EXTRA_URL, clickeditem.getmDate());
              startActivity(detailintent);
      }
  }
  </code></pre>
  
  <p>My Adapter Code</p>
  
  <pre><code>public class ExampleAdapter extends RecyclerView.Adapter &lt;ExampleAdapter.ExampleViewHolder&gt;{
      private Context mContext;
      private ArrayList&lt;ExampleItem&gt; mExampleList;
      private onItemClickListener mListener;
      public interface onItemClickListener{
          void onItemClick(int position);
      }
  
      public void setOnItemClickListener(onItemClickListener listener){
          mListener = listener;
      }
      public ExampleAdapter(Context context, ArrayList&lt;ExampleItem&gt; examplelist){
          mContext =context;
          mExampleList = examplelist;
      }
  
  
      @NonNull
      @Override
      public ExampleViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          View v = LayoutInflater.from(mContext).inflate(R.layout.example_item,parent,false);
          return new ExampleViewHolder(v);
      }
  
      @Override
      public void onBindViewHolder(@NonNull ExampleViewHolder holder, int position) {
          ExampleItem currentItem = mExampleList.get(position);
          String imageUrl = currentItem.getmImageUrl();
          String creatorName = currentItem.getmCreator();
          String cat =currentItem.getmCat();
          String postdate = currentItem.getmDate();
          String dateall = currentItem.getmAll();
          holder.mTextViewCreator.setText(creatorName);
          holder.mTextViewCat.setText(cat);
          holder.mDateAll.setText(dateall);
          Glide.with(mContext)
                  .load(imageUrl)
                  .into(holder.mImageView);
  
      }
  
      @Override
      public int getItemCount() {
          return mExampleList.size();
      }
  
      public class ExampleViewHolder extends RecyclerView.ViewHolder{
          public ImageView mImageView;
          public TextView mTextViewCreator;
          public TextView mTextViewCat;
          public TextView mDateAll;
          public ExampleViewHolder(View itemView) {
              super(itemView);
              mImageView = itemView.findViewById(R.id.image_view);
              mTextViewCreator = itemView.findViewById(R.id.text_view_creator);
              mTextViewCat = itemView.findViewById(R.id.text_view_cat);
              mDateAll = itemView.findViewById(R.id.date_views);
              itemView.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View view) {
                      if(mListener != null){
                          int position = getAdapterPosition();
                          if (position !=RecyclerView.NO_POSITION){
                              mListener.onItemClick(position);
                          }
                      }
                  }
              });
          }
      }
  }
  </code></pre>