title: Drawable in ViewModel with MVVM concept
body: <p>I confused with MVVM concept that ViewModel should not reference View.<br>
  In my usecase , I have to use Databinding and wrapping the Drawable by LiveData and observe its value in xml view.  </p>
  
  <p>Base on suggestion from Android I implemented as below<br>
  <a href="https://developer.android.com/topic/libraries/architecture/viewmodel" rel="nofollow noreferrer">https://developer.android.com/topic/libraries/architecture/viewmodel</a></p>
  
  <blockquote>
    <p>If the ViewModel needs the Application context, for example to find a
    system service, it can extend the AndroidViewModel class and have a
    constructor that receives the Application in the constructor, since
    Application class extends Context.</p>
  </blockquote>
  
  <p>MyViewModel.kt</p>
  
  <pre><code>class MyViewModel(application: Application): AndroidViewModel(application){  
    private val _showIcon = MutableLiveData&lt;Drawable&gt;  
    val showIcon: LiveData&lt;Drawable&gt;  
      get() = _showIcon
  
    fun applyChanged(){
       if(condition){
         _showIcon.value = AppCompatResources.getDrawable(getApplication(),R.drawable.icon1)
       }else{
         _showIcon.value = null
       }
    }
  }
  </code></pre>
  
  <p>main_activity.xml</p>
  
  <pre><code>   android:drawableTop="@{viewModel.showIcon}"
  </code></pre>
  
  <p>Question:<br>
  This approach is OK with MVVM concept ? Is there anything I have to do with context inside ViewModel to prevent leak memory problem?<br>
  Or any potential problem in my code ?  </p>
  
  <p>Thank you so much !</p>