title: How to get SUM of child entries in Firebase Database
body: <p>I am trying to get the SUM of all int's in a child of my Firebase Database. </p>
  
  <p>My Database is set up like</p>
  
  <pre><code>beans-card
     - users
          - (UID from Firebase Auth)
               - Receipt
                     - keyID
                         - amount: 11
                         - points: 22
                     - keyID
                         - amount: 11
                         - points: 22
  </code></pre>
  
  <p>I want to get the SUM of points and show in Textview in different Fragment</p>
  
  <p>here is my Receipt Class</p>
  
  <pre><code>public class Receipt {
  
      public int amount;
      public int points;
  
      public Receipt(){}
  
      public Receipt(int amount, int points) {
          this.amount = amount;
          this.points = points;
      }
  
      public int getAmount(){
          return amount;
      }
  
      public void setAmount(int amount){
          this.amount = amount;
      }
  
      public int getPoints(){
          return points;
      }
  
      public void setPoints(int points){
          this.points = points;
      }
  
  }
  </code></pre>
  
  <p>and here is how i'm entering the data into my database</p>
  
  <pre><code>Receipt receipt = new Receipt(second, second*2);
  
  mDatabase.child("users").child(mUserId)
  .child("Receipt").push().setValue(receipt);
  </code></pre>