title: Get data from firebase with Result of LiveData in viewmodel
body: <p>I want to get 2 objects from firebase and I want to display combine results on the Recyclerview using viewmodel. I have created a viewmodel that gets the one object from firebase and based on id from this object I want to get the other object and update the ui.
  some code of view model class</p>
  
  <pre><code>  private static final DatabaseReference POST_REF =
          FirebaseDatabase.getInstance().getReference("/Post");
  
  private final FirebaseQueryLiveData liveData = new 
  FirebaseQueryLiveData(POST_REF);
   @NonNull
  public LiveData&lt;DataSnapshot&gt; getDataSnapshotLiveData() {
  
      return liveData;
  
  }
  </code></pre>
  
  <p>FirebaseQueryLiveData class</p>
  
  <pre><code>private final MyValueEventListener listener = new MyValueEventListener();
  
  
  public FirebaseQueryLiveData(DatabaseReference ref) {
      this.query = ref;
  }
  
  @Override
  protected void onActive() {
      Log.d(LOG_TAG, "onActive");
      query.addValueEventListener(listener);
  }
  
  @Override
  protected void onInactive() {
      Log.d(LOG_TAG, "onInactive");
      query.removeEventListener(listener);
  }
  </code></pre>
  
  <p>How to get the second object from firebase using the result of first and notify the livedata about it </p>
  
  <p>First object is post of users and second object is userinfo . I want to display combine result on Ui.</p>
  
  <p>DataBase Structure I Want to get post and based on ids in post I want to get userdetails
      <a href="https://i.stack.imgur.com/O2IAC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O2IAC.png" alt="enter image description here"></a></p>