SHARE
TWEET

Untitled

a guest Jun 19th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mCevap.child(post_key).addListenerForSingleValueEvent(new ValueEventListener() {
  2.     @Override
  3.     public void  onDataChange(DataSnapshot dataSnapshot) {
  4.         size = (int) dataSnapshot.getChildrenCount();  
  5.     }
  6.  
  7.     @Override
  8.     public void onCancelled(DatabaseError databaseError) {
  9.     }
  10. });
  11. viewHolder.setCount(size);
  12.      
  13. System.out.println("Before addListenerForSingleValueEvent");
  14. mCevap.child(post_key).addListenerForSingleValueEvent(new ValueEventListener() {
  15.     @Override
  16.     public void  onDataChange(DataSnapshot dataSnapshot) {
  17.         System.out.println("In onDataChange");
  18.     }
  19.  
  20.     @Override
  21.     public void onCancelled(DatabaseError databaseError) {
  22.         throw databaseError.toException(); // don't ignore errors
  23.     }
  24. });
  25. System.out.println("After addListenerForSingleValueEvent");
  26.      
  27. mCevap.child(post_key).addListenerForSingleValueEvent(new ValueEventListener() {
  28.     @Override
  29.     public void  onDataChange(DataSnapshot dataSnapshot) {
  30.         System.out.println("size ="+dataSnapshot.getChildrenCount());
  31.     }
  32.  
  33.     @Override
  34.     public void onCancelled(DatabaseError databaseError) {
  35.         throw databaseError.toException(); // don't ignore errors
  36.     }
  37. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top