title: Setting up LiveData observer in custom view without LifecycleOwner
body: <p>I'm trying out the new Android Architecture components and have run into a road block when trying to use the MVVM model for a custom view.</p>
  <p>Essentially I have created a custom view to encapsulate a common UI and it's respective logic to use throughout the app. I can set up the ViewModel in the custom view but then I'd have to either use <code>observeForever()</code> or manually set a <code>LifecycleOwner</code> in the custom view like below but neither seem correct.</p>
  <h2>Option 1) Using <code>observeForever()</code></h2>
  <p><strong>Activity</strong></p>
  <pre><code>class MyActivity : AppCompatActivity() {
  
      lateinit var myCustomView : CustomView
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          myCustomView = findViewById(R.id.custom_view)
          myCustomView.onAttach()
      }
  
      override fun onStop() {
          myCustomView.onDetach()
      }
  }
  </code></pre>
  <p><strong>Custom View</strong></p>
  <pre><code>class (context: Context, attrs: AttributeSet) : RelativeLayout(context,attrs){
  
      private val viewModel = CustomViewModel()
  
      fun onAttach() {
          viewModel.state.observeForever{ myObserver }
      }
  
      fun onDetach() {
          viewModel.state.removeObserver{ myObserver }
      }
  }
  </code></pre>
  <h2>Option 2) Setting lifecycleOwner from Activity`</h2>
  <p><strong>Activity</strong></p>
  <pre><code>class MyActivity : AppCompatActivity() {
  
      lateinit var myCustomView : CustomView
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          myCustomView = findViewById(R.id.custom_view)
          myCustomView.setLifeCycleOwner(this)
      }
  }
  </code></pre>
  <p><strong>Custom View</strong></p>
  <pre><code>class (context: Context, attrs: AttributeSet) : RelativeLayout(context,attrs){
  
      private val viewModel = CustomViewModel()
  
      fun setLifecycleOwner(lifecycleOwner: LifecycleOwner) {
          viewModel.state.observe(lifecycleOwner)
      }
  }
  </code></pre>
  <p>Am I just misusing the patterns and components? I feel like there should be a cleaner way to compose complex views from multiple sub-views without tying them to the Activity/Fragment</p>