title: What do I supply to "LifeCycleOwner" parameter on observe in Kotlin?
body: <p>I'm fairly new on the Android Room, which uses LiveData that I'm also not familiar with. I noticed that on the tutorials, the data returned is using <code>LiveData</code> wrapper, like this:</p>
  
  <pre><code>@Dao
  interface PersonDao {
      @Query("SELECT * FROM person")
      fun getAll(): LiveData&lt;List&lt;Person&gt;&gt;
  }
  </code></pre>
  
  <p>Then to read the data, I use this code:</p>
  
  <pre><code>class PersonListActivity: AppCompatActivity() {
  
      List&lt;Person&gt; personList = listOf()
  
      init {
          val db = RoomDatabase.getDatabaseInstance()
          db.personDao.getAll().observe(this, Observe&lt;List&lt;Person&gt;&gt; { data -&gt;
              personList = data
          })
      }
  
  }
  </code></pre>
  
  <p>The problem is the IDE raise error "type mismatch". Required: LifeCycleOwner. Found: PersonListActivity. I don't understand how the tutorials can casually supply "this" into the observe owner parameter. I've also tried to supply <code>context</code> and <code>applicationContext</code> into the owner parameter and it doesn't work.</p>
  
  <p>After I examine the <code>LifeCycleOwner</code> class, I tried to add the LifeCycleOwner implementation. But then the class requires <code>getLifeCycle()</code> function to be implemented. So I'm back at zero.</p>
  
  <pre><code>class PersonListActivity: AppCompatActivity(), LifeCycleOwner {
  
      List&lt;Person&gt; personList = listOf()
  
      init {
          val db = RoomDatabase.getDatabaseInstance()
          db.personDao.getAll().observe(this, Observe&lt;List&lt;Person&gt;&gt; { data -&gt;
              personList = data
          })
      }
  
      override fun getLifeCycle() {
          // what should I return here??????
      }
  
  }
  </code></pre>
  
  <p>Why all the tutorials I read about LiveData don't mention anything at all about LifeCycleOwner? Am I using the wrong observe function here?</p>
  
  <pre><code>public abstract class LiveData&lt;T&gt; {
      ...
      @MainThread
      public void observe(@NonNull LifecycleOwner owner, @NonNull Observer&lt;? super T&gt; observer) { ... }
      ...
  }
  </code></pre>