title: Issues in query on recyclerView from firebase
body: <p>Currently i'am facing with the issue is what while querying firebase recyclerView adapter for sorting dates ,everything works fine in that page, but when clicks on the particular event and goes to the next page some data's is missing or malfunctioning, look at the code below,</p>
  
  <pre><code>EventsRef.addListenerForSingleValueEvent(new ValueEventListener() {
          @Override
          public void onDataChange(@NonNull DataSnapshot dataSnapshot)
          {
              if (dataSnapshot.exists())
              {
                  for (DataSnapshot ds : dataSnapshot.getChildren())
                  {
                      String eventId = ds.child("Eid").getValue(String.class);
                      String serveCount = ds.child("Serve").getValue(String.class);
  
                      list.add(eventId);
                      list3.add(serveCount);
  
                  }
  
                  if (list.size() != 0)
                  {
                     RecyclerView();
                  }
  
              }
              else
              {
                  progressDialog.dismiss();
                  TextView txt = (TextView) findViewById(R.id.txt);
                  txt.setVisibility(View.VISIBLE);
              }
  
          }
  
          @Override
          public void onCancelled(@NonNull DatabaseError databaseError) {
  
          }
      });
  }
  
  
  private void RecyclerView()
  {
      Query ref = EventsRef.orderByChild("Sort_Date");
  
      //Display events
      FirebaseRecyclerOptions&lt;WorkerMyEvents&gt; options =
              new FirebaseRecyclerOptions.Builder&lt;WorkerMyEvents&gt;()
                      .setQuery(ref, WorkerMyEvents.class)
                      .build();
  
      FirebaseRecyclerAdapter&lt;WorkerMyEvents, WorkerMyEventViewHolder&gt; firebaseRecyclerAdapter
              = new FirebaseRecyclerAdapter&lt;WorkerMyEvents, WorkerMyEventViewHolder&gt;(options) {
          @Override
          protected void onBindViewHolder(@NonNull final WorkerMyEventViewHolder eventsViewHolder, int i, @NonNull final WorkerMyEvents newEvents)
          {
              //Id with date and time key
              final String IDs = getRef(i).getKey();
              final String eventIDs = IDs.substring(0,18);
  
              final String serve = list3.get(i);
  
              NewEventsRef.child(eventIDs).addListenerForSingleValueEvent(new ValueEventListener() {
                  @Override
                  public void onDataChange(@NonNull DataSnapshot dataSnapshot)
                  {
                      if (dataSnapshot.exists())
                      {
                          //Here will have some data's to display...
                         // I will retrieve Eid from New Events node
                          eventsViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
                              @Override
                              public void onClick(View v) {
                                  Intent intent = new Intent(WorkerMyEventActivity.this, WorkerMyEventDetailsActivity.class);
                                  intent.putExtra("Eid", Eid);
                                  intent.putExtra("sC", serve);
                                  startActivity(intent);
                              }
                          });
  
                          eventsViewHolder.opt_out.setOnClickListener(new View.OnClickListener() {
                              @Override
                              public void onClick(View v)
                              {
                                  DeletingEvent(IDs, Eid, serve);
                              }
                          });
  
                          eventsViewHolder.cash_received.setOnClickListener(new View.OnClickListener() {
                              @Override
                              public void onClick(View v)
                              {
  
                              }
                          });
  
                      }
                      else
                      {
                          progressDialog.dismiss();
  
                          //notify to the participants...
                          //random key
                          SimpleDateFormat formatter = new SimpleDateFormat("ddMMYYYY");
                          Date date = new Date();
                          String tdyDate = formatter.format(date);
  
                          Calendar calendar = Calendar.getInstance();
                          SimpleDateFormat currentTime = new SimpleDateFormat("HHmma");
                          String saveCurrentTime = currentTime.format(calendar.getTime());
  
                          String randomkey = tdyDate + saveCurrentTime;
                          //random key
  
  
                          String Notify = "The event you participated has been deleted by contractor";
                          HashMap&lt;String,Object&gt; map = new HashMap&lt;&gt;();
                          map.put("message", eventIDs + " - " + Notify);
                          workerRef.child("Notifications").child(randomkey).updateChildren(map);
                          workerRef.child("Notifications").child("current_counts").child(randomkey).updateChildren(map);
  
                          //remove Live event event id's from database...
                          EventsRef.child(eventIDs).removeValue();
                          TextView txt = (TextView) findViewById(R.id.txt);
                          txt.setVisibility(View.VISIBLE);
                      }
                  }
  
                  @Override
                  public void onCancelled(@NonNull DatabaseError databaseError)
                  {
                      progressDialog.dismiss();
                  }
              });
  
          }
  
          @NonNull
          @Override
          public WorkerMyEventViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
          {
              View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.worker_my_event_layout, parent, false);
              WorkerMyEventViewHolder holder = new WorkerMyEventViewHolder(view);
              return holder;
          }
      };
      recyclerView.setAdapter(firebaseRecyclerAdapter);
      firebaseRecyclerAdapter.startListening();
  </code></pre>
  
  <p>this is my code all works fine in current activity. But while doing this  [ Query ref = EventsRef.orderByChild("Sort_Date"); ] some data's or reference problem is coming in the next page .</p>
  
  <p>NextActivity(); //code where iam facing issue</p>
  
  <pre><code>ref3Male.child(userID).addListenerForSingleValueEvent(new ValueEventListener() {
          @Override
          public void onDataChange(@NonNull DataSnapshot dataSnapshot)
          {
              if (dataSnapshot.exists())
              {
                  //This needs to come ,if that query is not applied in the previous activity this works fine. but while using that it is not working, its movingto else part.
              }
              else{
  
              }
          }
  
          @Override
          public void onCancelled(@NonNull DatabaseError databaseError) {
  
          }
      });
  </code></pre>
  
  <p>In the above code actually the dataSnapShot will exists if the query is not applied in previous activity, but while using that it going to else part, Please guide me where i'm doing mistake friends. Thanks in advance.</p>
  
  <p><img src="https://i.stack.imgur.com/vdEWb.jpg" alt="enter image description here"></p>
  
  <p>By using the above database structure i will get key by sorting dates and by using the key i will get details from the node which that database structure is below ,( i posted only one node structure but it will have many)</p>
  
  <p><img src="https://i.stack.imgur.com/wNrXA.jpg" alt="enter image description here"></p>
  
  <p>That second image reference is what iam using in next activity()..</p>
  
  <p>And also now i have noticed and changed that date type from string to long type using timestamp , but still having that issue ...</p>
  
  <p>And also i researched something and noticed that in activity 1 there will have list of items in recycler view , in that only 1st and 2nd event is only  having that issue and remaining is working perfectly , by when i clicks that event those details viewing in next page.</p>
  
  <p>Now i noticed another thing was in the activity 1 ,for 1st two items the reference is not working (ref - is in the 1st image) and the remaining is working perfectly.</p>
  
  <pre><code>public class WorkerMyEvents
  {
  private String Eid;
  
  public WorkerMyEvents() {
  }
  
  public WorkerMyEvents(//Here also) {
     //Constructors
  }
  
  //Getters and setters
  </code></pre>
  
  <p>}</p>