title: Android different ways to create viewModel object which one to use when?
body: <p>I recently started with the ViewModel and AndroidViewModel, I see there are different approach to initialise a viewModel instance, for me all works fine, I just want to know which one to use when? and where should I initialise the viewModel object? following all are the different approach to get the viewModel instance and works for me:</p>
  <pre><code>    val myViewModel1 = ViewModelProvider(this, ViewModelProvider.NewInstanceFactory()).get(MyViewModel::class.java)
      val myViewModel2 = ViewModelProvider.AndroidViewModelFactory(this.application).create(MyViewModel::class.java)
      val myViewModel3 = ViewModelProvider(this).get(MyViewModel::class.java)
      val myViewModel4: MyViewModel by viewModels()
      val myViewModel5 by viewModels&lt;MyViewModel&gt;()
  </code></pre>
  <p>The easiest and most simple for me are 3rd, 4th and 5th, however I don't know what is the difference in all the five approaches, also please let me know if there any other way or optimal way to initialise my viewModel object, I do the initialisation on the global variable while declaring it, is it okay to initialise at the declaration time or it should be done inside some lifecycle method?</p>