title: Firebase - Multi Path Update using Transactions in Android Studio
body: <p>I've recently begun using the FirebaseDatabase library on Android Studio. So, I've read that when you update/modify multiple locations on your Firebase Database, in case any error occurs and to make sure that data isn't modified in some locations and not modified in other, <b>transactions</b> are used. <br><br></p>
  
  <p>Transactions in JavaScript have been covered thoroughly and proper documentation has been provided. But, the documentation for the Android Studio library isn't very clear. The links are <a href="https://firebase.google.com/docs/reference/android/com/google/firebase/database/Transaction.Handler" rel="nofollow noreferrer">link1</a> and <a href="https://firebase.google.com/docs/database/android/read-and-write" rel="nofollow noreferrer">link2</a>
   <br>
  <br>
  <br>
  What is Mutable data and what value does it hold? Right now, this is how I update or modify the data on my database. I need to update values at nodes posts and user <br><br></p>
  
  <pre><code>HashMap&lt;String, Object&gt; hm = new HashMap&lt;&gt;();
  hm.put("/users/"+key+"/name/","New Name");
  hm.put("/posts/"+key+"/number_of_posts/", 2);
  FirebaseDatabase.getInstance().getReference().updateChildren(hm, new DatabaseReference.CompletionListener() {
      @Override
      public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) {
          if(databaseError == null)
              Log.d(TAG, "TASK WAS SUCCESSFULLY COMPLETED");
          else
              Log.d(TAG, "SOMETHING WENT WRONG");
      }
  });
  </code></pre>
  
  <p>I know this is the wrong way to do this, so an explanation or a link to a tutorial to do this would be really helpful.</p>