title: Change items in recyclerview when item click on another
body: <p>I am creating an app where there are 2 <code>RecyclerView</code> in one layout. I set one for category and second for text based on category. when i am debug my code that give me recyclerview display null value on this line <code>recyclerView.setAdapter(adapter);</code> in adapter see in image</p>
  
  <p>I want to select category item then give the text that contain that category. </p>
  
  <pre><code>public class MainActivity extends AppCompatActivity implements AdapterView.OnItemClickListener {
      private List&lt;TextJson&gt; listtext;
      private List&lt;CategoryJson&gt; horizentallylist;
      private RecyclerView recyclerView , horizantalrcview;
      private RecyclerView.LayoutManager layoutManager;
      private RecyclerView.Adapter adapter;
  
      String textUrl = "http:www.extample.com/texturl.php";
      String categoryUrl ="http:www.extample.com/categoryurl.php";
      private static final String TAG = MainActivity.class.getSimpleName();
      private JSONArray result;
      ArrayAdapter&lt;String&gt; adapterSpin;
      CategoryJson categoryJson;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          recyclerView = (RecyclerView) findViewById(R.id.recyclerView_text);
          horizantalrcview = (RecyclerView)findViewById(R.id.recyclerView_cate);
          recyclerView.setHasFixedSize(true);
          layoutManager = new LinearLayoutManager(this);
          recyclerView.setLayoutManager(layoutManager);
          listtext = new ArrayList&lt;&gt;();
          horizentallylist = new ArrayList&lt;&gt;();
          getData();
          verticalData();
      }
  
      private void getData() {
          final ProgressDialog loading = ProgressDialog.show(this, "Loading Data", "Please wait...", false, false);
          loading.setCancelable(true);
          JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(textUrl,
                  new Response.Listener&lt;JSONArray&gt;() {
                      @Override
                      public void onResponse(JSONArray response) {
                          Log.e("text", "resopnce is =&gt;" + response);
                          loading.dismiss();
                          verticalParse(response);
                      }
                  },
                  new Response.ErrorListener() {
                      @Override
                      public void onErrorResponse(VolleyError error) {
                      }
                  });
          RequestQueue requestQueue = Volley.newRequestQueue(this);
          requestQueue.add(jsonArrayRequest);
      }
  
      private void verticalParse(JSONArray array) {
  
          for (int i = 0; i &lt; array.length(); i++) {
              TextJson jsonitem = new TextJson();
              JSONObject json = null;
              try {
                  json = array.getJSONObject(i);
                  String text = json.getString("txt");
                  String txtcate = json.getString("category");
                  jsonitem.setText_status(text);
                  jsonitem.setCategory(txtcate);
                  Log.e("text", "is==&gt;  " + text);
                  Log.e("cate", "is==&gt;  " + txtcate);
              } catch (JSONException e) {
                  e.printStackTrace();
              }
              listtext.add(jsonitem);
          }
  
          //Finally initializing our adapter
          adapter = new VerticalAdapter(listtext, this);
          adapter.notifyDataSetChanged();
          //Adding adapter to recyclerview
          recyclerView.setAdapter(adapter);
      }
  
  
  
      private void verticalData() {
          final ProgressDialog loading = ProgressDialog.show(this, "Loading Data", "Please wait...", false, false);
          loading.setCancelable(true);
          JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(categoryUrl,
                  new Response.Listener&lt;JSONArray&gt;() {
                      @Override
                      public void onResponse(JSONArray response) {
                          Log.e("Response is", "first==&gt;" + response);
                          loading.dismiss();
                          parseData(response);
                      }
                  },
                  new Response.ErrorListener() {
                      @Override
                      public void onErrorResponse(VolleyError error) {
                          if (error instanceof NoConnectionError) {
                              Log.e("NoConnectionError&gt;&gt;", "NoConnectionError....");
                          } else if (error instanceof AuthFailureError) {
                              Log.e("AuthFailureError&gt;&gt;&gt;", "AuthFailureError...");
                          } else if (error instanceof ServerError) {
                              Log.e("ServerError&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;", "ServerError.......");
                          } else if (error instanceof NetworkError) {
                              Log.e("NetworkError&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;", "NetworkError.......");
                          } else if (error instanceof ParseError) {
                              Log.e("ParseError&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;", "ParseError.......");
                          } else if (error instanceof TimeoutError) {
                              Log.d("TimeoutError&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;", "TimeoutError.......");
                          }
                      }
                  });
          RequestQueue requestQueue = Volley.newRequestQueue(this);
          requestQueue.add(jsonArrayRequest);
      }
  
      private void parseData(JSONArray array) {
          for (int i = 0; i &lt; array.length(); i++) {
              CategoryJson model1 = new CategoryJson();
              JSONObject json = null;
              try {
                  json = array.getJSONObject(i);
                  String imgurl = json.getString("cat_img");
                  String imgname = json.getString("category");
                  Log.e("value in","link=&gt;"+imgurl);
                  Log.e("value in","imagename=&gt;"+imgname);
                  model1.setImageUrl(imgurl);
                  model1.setName(imgname);
              } catch (JSONException e) {
                  e.printStackTrace();
              }
              horizentallylist.add(model1);
          }
          //Finally initializing our adapter
          adapter = new HorizantalAdapter(horizentallylist, this);
          adapter.notifyDataSetChanged();
          //Adding adapter to recyclerview
          horizantalrcview.setAdapter(adapter);
      }
  
  
      private void selectData() {
          NewModel newModel = new NewModel();
          final ProgressDialog loading = ProgressDialog.show(this, "Loading Data", "Please wait...", false, false);
          loading.setCancelable(true);
          String txtselect =newModel.getItem().toString();
          String select_cate ="http:www.extample.com/filter.php"+selectitem;
  
          JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(select_cate ,
                  new Response.Listener&lt;JSONArray&gt;() {
                      @Override
                      public void onResponse(JSONArray response) {
                          Log.e("text", "resopnce is =&gt;" + response);
                          loading.dismiss();
                          selectParse(response);
                      }
                  },
                  new Response.ErrorListener() {
                      @Override
                      public void onErrorResponse(VolleyError error) {
                      }
                  });
          RequestQueue requestQueue = Volley.newRequestQueue(this);
          requestQueue.add(jsonArrayRequest);
      }
  
      private void selectParse(JSONArray array) {
          for (int i = 0; i &lt; array.length(); i++) {
              TextJson jsonitem = new TextJson();
              JSONObject json = null;
              try {
                  json = array.getJSONObject(i);
                  String text = json.getString("txt");
                  String txtcate = json.getString("category");
                  jsonitem.setText_status(text);
                  jsonitem.setCategory(txtcate);
                  Log.e("text", "is==&gt;  " + text);
                  Log.e("cate", "is==&gt;  " + txtcate);
              } catch (JSONException e) {
                  e.printStackTrace();
              }
              listtext.add(jsonitem);
          }
          //Finally initializing our adapter
          adapter = new VerticalAdapter(listtext, this);
          adapter.notifyDataSetChanged();
          //Adding adapter to recyclerview
          recyclerView.setAdapter(adapter);
      }
  }
  </code></pre>
  
  <p><strong>HorizantalAdapter</strong></p>
  
  <pre><code>public class HorizantalAdapter extends RecyclerView.Adapter&lt;HorizantalAdapter.ViewHolder&gt; {
  
      private ImageLoader imageLoader;
      private Context context;
      List&lt;CategoryJson&gt; listmodel;
      NewModel newModel = new NewModel();
      String link;
  
      public HorizantalAdapter(List&lt;CategoryJson&gt; listmodel, Context context) {
          super();
          this.listmodel = listmodel;
          this.context = context;
          setHasStableIds(false);
      }
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View v = LayoutInflater.from(parent.getContext())
                  .inflate(R.layout.text_horigentally, parent, false);
          HorizantalAdapter.ViewHolder viewHolder = new HorizantalAdapter.ViewHolder(v);
          return viewHolder;
      }
  
      @Override
      public void onBindViewHolder(final HorizantalAdapter.ViewHolder holder, final int position) {
          CategoryJson imgModel = listmodel.get(position);
          imageLoader =CustomVolleyRequest.getInstance(context).getImageLoader();
          imageLoader.get(imgModel.getImageUrl(),imageLoader.getImageListener(holder.imageView,R.drawable.placeholder,android.R.drawable.ic_dialog_alert));
          holder.imageView.setImageUrl(imgModel.getImageUrl(),imageLoader);
          holder.textViewName.setText(imgModel.getName());
          holder.imageView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  link = listmodel.get(position).getName();
                  newModel.setItem(link);
                  Toast.makeText(context, "select item select"  +link, Toast.LENGTH_SHORT).show();
              }
          });
      }
      @Override
      public int getItemCount() {
          return listmodel.size();
      }
  
      public long getItemId(int position) {
          return position;
      }
  
      class ViewHolder extends RecyclerView.ViewHolder {
          public NetworkImageView imageView;
          public TextView textViewName;
  
          public ViewHolder(View itemView) {
              super(itemView);
              imageView = (NetworkImageView) itemView.findViewById(R.id.imageView_img);
              imageView.setScaleType(NetworkImageView.ScaleType.FIT_CENTER);
              textViewName = (TextView) itemView.findViewById(R.id.text_cate);
  
  
               }
          }
       }
  </code></pre>
  
  <p><strong>VerticalAdapter</strong></p>
  
  <pre><code>    public class VerticalAdapter extends RecyclerView.Adapter&lt;VerticalAdapter.ViewHolder&gt; {
      private Context context;
      String link;
      List&lt;TextJson&gt; listmodel;
      private Activity parentActivity;
      public VerticalAdapter(List&lt;TextJson&gt; listmodel, Context context) {
          super();
          this.listmodel = listmodel;
          this.context = context;
      }
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View v = LayoutInflater.from(parent.getContext())
                  .inflate(R.layout.text_virtically, parent, false);
          ViewHolder viewHolder = new ViewHolder(v);
          return viewHolder;
      }
      @Override
      public void onBindViewHolder(ViewHolder holder, final int position) {
          TextJson model = listmodel.get(position);
          holder.textViewName.setText(model.getText_status());
          holder.textViewName.setOnLongClickListener(new View.OnLongClickListener() {
              @Override
              public boolean onLongClick(View v) {
                  link = listmodel.get(position).getText_status();
                  return true;
              }
          });
      }
      @Override
      public int getItemCount() {
          return listmodel.size();
      }
  
      class ViewHolder extends RecyclerView.ViewHolder {
          public TextView textViewName;
          public ViewHolder(View itemView) {
              super(itemView);
              textViewName = (TextView) itemView.findViewById(R.id.texting_status);
           }
        }
  
   }
  </code></pre>
  
  <p><strong>Log</strong></p>
  
  <pre><code>08-01 18:28:14.021 11378-11378/com.vm.recyclervirtical E/text: is==&gt;  Stinging Jellyfish Come to Jersey, But Beaches Sti
  08-01 18:28:14.021 11378-11378/com.vm.recyclervirtical E/cate: is==&gt;  speech
  08-01 18:28:14.021 11378-11378/com.vm.recyclervirtical E/text: is==&gt;  Koala Facts for Kids | Australian Animals
  08-01 18:28:14.021 11378-11378/com.vm.recyclervirtical E/cate: is==&gt;  motivational
  08-01 18:28:14.021 11378-11378/com.vm.recyclervirtical E/text: is==&gt;  Antarctic penguins ielts reading passage
  08-01 18:28:14.021 11378-11378/com.vm.recyclervirtical E/cate: is==&gt;  dance
  08-01 18:28:14.061 11378-11378/com.vm.recyclervirtical E/Cache is: 0_0==&gt;com.android.volley.toolbox.DiskBasedCache@41812ce8
  08-01 18:28:24.861 11378-11378/com.vm.recyclervirtical E/text: resopnce is =&gt;http://www.example.com/filtered/evideo/json/jsoncategory.php?category=motivational
  08-01 18:28:25.331 11378-11378/com.vm.recyclervirtical E/text: resopnce is =&gt;[{"txt":"Koala Facts for Kids | Australian Animals"}]
  08-01 18:28:25.351 11378-11378/com.vm.recyclervirtical E/text: is==&gt;  Koala Facts for Kids | Australian Animals
  </code></pre>
  
  <p><strong>Image</strong></p>
  
  <p><a href="https://i.stack.imgur.com/mEDC1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mEDC1.png" alt="enter image description here"></a></p>
  
  <p><strong>After debug</strong></p>
  
  <p><a href="https://i.stack.imgur.com/XXv4J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XXv4J.png" alt="debug app"></a></p>