title: Returning value from runInTransaction() In Android Room database
body: <p>There is not much documentation to understand how exactly does runInTransaction() method works. 
  While executing multiple operations on different DAO's if no value is to be returned I could use <code>runInTransaction(Runnable body)</code> OR <code>runInTransaction(Callable&lt;V&gt; body)</code> if any result is to be returned.</p>
  
  <p><strong>Query that I have:</strong>
  If all the queries in the transaction are successful, then I want to return an image object that needs to be uploaded to a server on successful transaction
  If any exception occurred or the transaction was not successful I need to return a boolean with false to indicate the user that some error occurred.</p>
  
  <p><strong>Here is the method:</strong></p>
  
  <pre><code>public boolean userCheckedIn(final User user) {
      try {
          appDatabase.runInTransaction(new Callable&lt;Object&gt;() {
              @Override
              public Object call() throws Exception {
                  if (user != null) {
  
                     //Add entry in table A
                       appDatabase.UserDao().add(user);
  
                     //Update entry in table B 
  
                     //Delete an entry from table C 
  
                      Event image = updateUserAction(action);
                      return image;
                  }
                  return null;
              }
          });
  
      } catch (Exception e) {
          return false;
      }
      return true;
  }
  </code></pre>
  
  <p>In the above method, what I intend to do is, if all the database executions are a success I need to return an image which will be uploaded to the server. If there is any exception that occurred or any error occurred while doing the db transaction I need to return <code>false</code> to let user know an error occurred. Not sure if I got it right. Also, should I be putting the runInTransaction in try catch block ?</p>