title: What is the difference between ViewModel and AndroidViewModel
body: <p>For anyone having this question,</p>
  
  <p>As per Android Documentation,</p>
  
  <blockquote>
    <p>Since the ViewModel outlives specific activity and fragment instantiations, it should never reference a View, or any class that may hold a reference to the activity context. 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>Documentation can be found here :
  <a href="https://developer.android.com/topic/libraries/architecture/viewmodel.html" rel="nofollow noreferrer">https://developer.android.com/topic/libraries/architecture/viewmodel.html</a></p>
  
  <p>Edit:
  For duplicate explanation: 
  I mean you can extend class to ViewModel as well as AndroidViewModel. When you should extend which, the above explanation is for that only. The links above tells about ViewModel of MVVM architecture in general and not the android.arch.lifecycle.ViewModel </p>