title: Struggle to get the same ViewModel instance
body: <p>I'm not sure if I understand <code>ViewModel</code> architecture correctly in Android. I suppose ViewModel lifecycle is tie to the activity so we are expecting the same instance and it doesn't matter if we are passing the activity or fragment context to <code>ViewModelProvider</code>?</p>
  
  <p>Anyway, here's my ViewModel:</p>
  
  <pre><code>class MainViewModel : ViewModel() {
      var teamName: String = "Warriors";
  }
  </code></pre>
  
  <p>Here's my Activity:</p>
  
  <pre><code>class MainActivity : AppCompatActivity() {
      private lateinit var viewModel: MainViewModel
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.main_activity)
          viewModel = ViewModelProviders.of(this).get(MainViewModel::class.java)
  
          viewModel.teamName = "Cavaliers";
          Log.d("YouQi", "activity viewModel.teamName: ${viewModel.teamName}");
  
          if (savedInstanceState == null) {
              supportFragmentManager.beginTransaction()
                      .replace(R.id.container, MainFragment.newInstance())
                      .commitNow()
          }
      }
  }
  </code></pre>
  
  <p>and lastly here's my Fragment:</p>
  
  <pre><code>class MainFragment : androidx.fragment.app.Fragment() {
      companion object {
          fun newInstance() = MainFragment()
      }
  
      private lateinit var viewModel: MainViewModel
  
      override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
          return inflater.inflate(R.layout.main_fragment, container, false)
      }
  
      override fun onActivityCreated(savedInstanceState: Bundle?) {
          super.onActivityCreated(savedInstanceState)
          viewModel = ViewModelProviders.of(this).get(MainViewModel::class.java)
          Log.d("YouQi", "fragment viewModel.teamName: ${viewModel.teamName}");
      }
  
  }
  </code></pre>
  
  <p>I'm getting the below output in Logcat:</p>
  
  <pre><code>2018-06-03 16:06:24.591 31124-31124/com.axzae.zapkotlin D/YouQi: activity viewModel.teamName: Cavaliers
  2018-06-03 16:06:24.652 31124-31124/com.axzae.zapkotlin D/YouQi: fragment viewModel.teamName: Warriors
  </code></pre>
  
  <p>It shows the value did not update to Cavaliers. am I using ViewModel wrongly and should be using Dagger to achieve singleton?</p>