title: Android: How to create only one instance of DatabaseRepository.kt and use it in different activities?
body: <p><code>EDIT: I NEED TO PASS A CONTEXT AS A PARAMETER TO THE CLASS</code></p>
  <p>(<code>DataStore</code> and <code>repository</code> is the same class, don't get confused)</p>
  <p>I have two activities, <code>A</code> and <code>B</code> and one <code>repository</code>. Activity <code>A</code> opens activity <code>B</code> and activity <code>B</code> saves data in the <code>repository</code>(<code>DataStore</code> a part of android jetpack).</p>
  <p>I am using <code>LiveData</code> in both the activities to observe data change in the <code>DataStore</code>.</p>
  <p>After updating new values in the <code>DataStore</code> from activity <code>B</code>, the <code>LiveData</code> in the activity <code>B</code> gets new updated values as expected. But when i return back to activity <code>A</code> the <code>LiveData</code> gets the old the data (expecting the new updated data).</p>
  <p>I realized that it is happening because i am creating two instances of the <code>repository</code> in both the activities.</p>
  <p>How can i create only one instance of the <code>repository</code> class and use it in both the activities? If there's better way to do it then that solution is also welcomed.</p>