title: how to observe a liveData only for the new update after the subscription to the liveData
body: <p>using PagedList,  and here it does not have database back,  but a data list (call it <code>CachedDataList</code>) in the memory which could be filled in by <code>fetchMore()</code> function.</p>
  
  <p>Having the <code>PositionalDataSource</code>, <code>DataSource.Factory</code> and <code>PagedList.BoundaryCallback</code>, it works but one issue here.</p>
  
  <p>The flow is the PositionalDataSource's <code>loadInitial()</code> will be called at beginning to start to load data from the  <code>CachedDataList</code>,  and call <code>loadRange()</code> after that to continue loading data from the  <code>CachedDataList</code> by page size.</p>
  
  <p>When all data from the <code>CachedDataList</code> are paged off, the <code>BoundaryCallback::onItemAtEndLoaded()</code> will be called  (if there is no backing data at beginning then the <code>BoundaryCallback::onZeroItemsLoaded()</code> is called),</p>
  
  <p>In there it will start to asking fetchMore to append more data into the <code>CachedDataList</code>,  and when the new data is appended to it then call the DataSource's <code>invalidate()</code> to restart the new PagedList and DataSource pair, and starting from PositionalDataSource's <code>loadInitial()</code> again.</p>
  
  <p>It is done by </p>
  
  <pre><code>observableCachedData.observe(owner, refreshHandler!!) 
  //??? TODO: how to only listen to newly posted data after 
  //starting the observe?  
  //DOC: 'If LiveData already has data set, it will be delivered to the observer.'
  
  // fetchMore
  val didFetch = dataRequester.fetchMore()  //asyc call
  </code></pre>
  
  <p>here, it observes the observableCachedData's change, and if there is change then the  <code>onChanged()</code> of the </p>
  
  <pre><code>class RefreshHandler(val observableCachedData: MutableLiveData&lt;List&lt;Data&gt;&gt;) : Observer&lt;List&lt;Data&gt;&gt; {
  override fun onChanged(datalist: List&lt;Data&gt;?)
  </code></pre>
  
  <p>will be called, and in which to call the DataSource's invalidate()</p>
  
  <p>but the subscription of <code>observableCachedData.observe()</code> causes the <code>refreshHandler</code> called immediately (it's by design as stated in the DOC),  this behavior is not desired here since we want the handler is called when the new data is append to the <code>CachedDataList</code>.</p>
  
  <p>i.e. the <code>CachedDataList</code> had 30 data,  when do fetchMore() there will be another 30 data appended to it, become 60.  But this <code>onChange()</code> is called with data still at 30 (the append has not been coming yet).</p>
  
  <p>Is there a way to subscribe to a live data but only get notified for update that happened after it is subscribed to it?</p>
  
  <pre><code>class DataBoundaryCallback(
          private val owner: LifecycleOwner,
          private val dataRequester: FetchMoreRequester,
          private val dataSourceFactory: DataSourceFactory?
  ) : PagedList.BoundaryCallback&lt;IData&gt;() {
  
      private var hasRequestInProgress = false
  
      override fun onZeroItemsLoaded() {
          requestAndSaveData()
      }
  
      override fun onItemAtEndLoaded(itemAtEnd: IData) {
          requestAndSaveData()
      }
  
      private fun requestAndSaveData() {
  
          if (hasRequestInProgress) return
  
          hasRequestInProgress = true
  
          // ask dataRequester to fetchMore
          // setup observer
  
          val cachedDataList = dataRequester.getCachedLiveData()
          val observableCachedData = cachedDataList.getLiveData()
          refreshHandler = RefreshHandler(observableCachedData)
  
          observableCachedData.observe(owner, refreshHandler!!) //??? TODO: how to only listen to newly posted data after starting the observe?  DOC: 'If LiveData already has data set, it will be delivered to the observer.'
  
          // fetchMore
          val didFetch = dataRequester.fetchMore()
          if (!didFetch) {  //not stated fetch
              hasRequestInProgress = false
              observableCachedData.removeObserver(refreshHandler!!)
          }
      }
  
      var refreshHandler : RefreshHandler? = null
      inner class RefreshHandler(val observableCachedData: MutableLiveData&lt;List&lt;Data&gt;&gt;) : Observer&lt;List&lt;Data&gt;&gt; {
          override fun onChanged(datalist: List&lt;Data&gt;?) {
              observableCachedData.removeObserver(refreshHandler!!)
              val dataSource = dataSourceFactory.getPositionalDataSource()
  
              // to start a new PagedList and DataSource pair flow
              // and trigger the DataSource's loadInitial()
              dataSource.invalidate()
          }
      }
  }
  </code></pre>