Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. ref2 = FirebaseDatabase.getInstance().getReference();
  2. mDatabase = FirebaseDatabase.getInstance().getReference();
  3.  
  4. Query query = ref2.child("place_id").orderByChild("placeID").equalTo(resID);
  5. query.addListenerForSingleValueEvent(new ValueEventListener() {
  6. @Override
  7. public void onDataChange(DataSnapshot dataSnapshot) {
  8. if(dataSnapshot.exists()){
  9. RestaurantInformation resInfo_P = dataSnapshot
  10. .child("place_id")
  11. .child(resID).getValue(RestaurantInformation.class);
  12.  
  13. businessID = resInfo_P.getBusinessID(); // null object exception
  14.  
  15.  
  16. } else {
  17.  
  18. ...
  19. }
  20. }
  21.  
  22. @Override
  23. public void onCancelled(DatabaseError databaseError) {
  24.  
  25. }
  26. });
  27.  
  28. public class RestaurantInformation {
  29.  
  30. private String resName;
  31. private String status;
  32. private String businessID;
  33. private String placeID;
  34.  
  35. public RestaurantInformation() {
  36.  
  37. }
  38.  
  39. public RestaurantInformation(String businessID, String placeID) {
  40. this.businessID = businessID;
  41. this.placeID = placeID;
  42. }
  43.  
  44. public RestaurantInformation(String resName) {
  45. this.resName = resName;
  46.  
  47. }
  48.  
  49. public String getResName() {
  50. return resName;
  51. }
  52.  
  53. public void setResName(String resName) {
  54. this.resName = resName;
  55. }
  56.  
  57. public String getBusinessID() {
  58. return businessID;
  59. }
  60.  
  61. public void setBusinessID(String placeID) {
  62. this.businessID = placeID;
  63. }
  64.  
  65. public String getPlaceID() {
  66. return placeID;
  67. }
  68.  
  69. public void setPlaceID(String placeID) {
  70. this.placeID = placeID;
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement