Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. private void getOrderID() {
  2.  
  3. for (int i = 0; i < userID.size(); i++) {
  4. databaseReference.child(opearatorID).child(userID.get(i)).addValueEventListener(new ValueEventListener() {
  5. @Override
  6. public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
  7. for (DataSnapshot childSnapshot : dataSnapshot.getChildren()) {
  8. keyStatusRelation.put(childSnapshot.getKey(),childSnapshot.getValue(Order.class).getStatus());
  9. }
  10. loadData();
  11.  
  12. }
  13.  
  14. @Override
  15. public void onCancelled(@NonNull DatabaseError databaseError) {
  16.  
  17. }
  18. });
  19.  
  20. }
  21.  
  22. }
  23.  
  24. public static void loadData() {
  25.  
  26. for (int i=0;i<userID.size();i++){
  27. statusRefrenceLiving.child(userID.get(i)).addValueEventListener(new ValueEventListener() {
  28. @Override
  29. public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
  30. for (DataSnapshot childSnapshot : dataSnapshot.getChildren()) {
  31. Order order = childSnapshot.getValue(Order.class);
  32. if(keyStatusRelation.get(childSnapshot.getKey()).equals("0")||keyStatusRelation.get(childSnapshot.getKey()).equals("2")){
  33. bookingmList.add(order);
  34. bookingrecyclerView.setAdapter(bookingAdapter);
  35.  
  36. }
  37. if(keyStatusRelation.get(childSnapshot.getKey()).equals("1")){
  38. bookedmList.add(order);
  39. bookedrecycleView.setAdapter(bookedAdapter);
  40.  
  41. }
  42. if(keyStatusRelation.get(childSnapshot.getKey()).equals("3")){
  43. LivingmList.add(order);
  44. LivingrecycleView.setAdapter(livingAdapter);
  45.  
  46. }
  47.  
  48. }
  49.  
  50. }
  51. @Override
  52. public void onCancelled (@NonNull DatabaseError databaseError){
  53.  
  54. }
  55. });
  56.  
  57. }
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement