title: How do I initialize viewmodel in addedditactivity, is there a better alternative?
body: <p>I have this database that contains information about celebrities, lots of information, ie movies, roles, articles...</p>
  <p>Without the viewmodel, all of the stuff in the edit text gets lost. So i dont want to lose all of that
  info on rotation.</p>
  <p>So i send an intent with all the relevant info of a selected celebrity(sql room) to the addeditactivity, so now how do i initialize the viewmodel? If I do getStringExtra in onCreate, wouldn't that just rewrite the viewmodel again when the activity gets recreated?</p>
  <p>how do i get around this, also is there a better alternative? im a beginner, thanks in advance!</p>
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.activity_main);
     // ......... shared preferences code .................
     // get intent code ................
  
     mViewModel = ViewModelProviders.of(this).get(testViewModel.class);
     mViewModel.celebName = intent.getStringExtra(CELEB_NAME);
     // similar..........
    
  }
  </code></pre>