Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public class Easy {
  2.  
  3. String a ;
  4. String q ;
  5. String r ;
  6.  
  7.  
  8. public Easy()
  9. {
  10. this.q = "" ;
  11. this.a = "" ;
  12. this.r = "" ;
  13. }
  14. //getters and setters below
  15.  
  16. }
  17.  
  18. public void generateData(int index)
  19. {
  20. //URL is root url
  21. final Firebase firebase = new Firebase(FirebaseConfig.URL) ;
  22.  
  23. //for the first time index is 1 , then I increment it when I need
  24. //next query
  25.  
  26. //I have not only EasyQuestions child and I have also another
  27. // severalchilds
  28.  
  29. firebase.child("EasyQuestions").
  30. child(String.valueOf(index)).addValueEventListener(new
  31. ValueEventListener() {
  32. @Override
  33. public void onDataChange(DataSnapshot dataSnapshot) {
  34. Easy easy = new Easy();
  35. //I get error below
  36. easy = dataSnapshot.getValue(Easy.class) ;
  37. }
  38.  
  39. @Override
  40. public void onCancelled(FirebaseError firebaseError) {
  41.  
  42. }
  43. });
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement