LiveData vs. ObservableField for data binding : <p>There are multiple questions on Stackoverflow related to difference between LiveData and ObservableField. Also, I have found multiple articles on the internet about this topic. All of them explain that LiveData is lifecycle-aware unlike ObservableField. Most of them also mention that it is advantageous to use LiveData instead of ObservableField if component such as Activity or Fragment observe the attribute, so we don't need to unsubscribe.</p>

<p>However, even after reading all of that, what is still not clear to me is if there is or isn't some advantage of using LiveData over ObservableField for data binding. For example:</p>

<p>ViewModel:</p>

<pre><code>class UserViewModel(user: User) : ViewModel {
    val userName = ObservableField&lt;String&gt;(user.name) // Option 1
    val userName = MutableLiveData&lt;String&gt;(user.name) // Option 2
}
</code></pre>

<p>Layout:</p>

<pre><code>&lt;layout&gt;
    &lt;data&gt;
        &lt;variable name="viewModel" type="com.example.UserViewModel" /&gt;
    &lt;/data&gt;
    ...
&lt;/layout&gt;
</code></pre>

<p>For option 2, I will also have to use <code>binding.setLifecycleOwner(activity)</code>, of course. Let's assume that nothing else than the layout observes <code>userName</code>.</p>

<p>My questions is:</p>

<p>Is there any advantage of using option 2 over option 1 or it doesn't matter in this case since the view (layout) will simply observe until it exists ?</p>

<p>What confuses me even more is this article:
<a href="https://android.jlelse.eu/android-architecture-components-livedata-with-data-binding-7bf85871bbd8" rel="noreferrer">https://android.jlelse.eu/android-architecture-components-livedata-with-data-binding-7bf85871bbd8</a>
which says: 
<em>"In the previous approach (without LiveData) if we wanted to show the data on the UI, we should previously check if it still exists. With LiveData we don’t need to worry about it because data will be posted only if Activity is at least started (so in started or resumed state)."</em></p>

<p>I don't understand this quoted part. What is meant by checking if UI still exists in case of "previous approach" which uses <code>ObservableField</code>? How would you apply this check for my example in option 1 ?</p>
