title: Room + ViewModel + LiveData + RecyclerView (MVVM) Part 7 - ADD NOTE ACTIVITY - Android Tutorial crashes
body: <p>I am following the "Room + ViewModel + LiveData + RecyclerView (MVVM) Android Studio Tutorial" from coding in flow on youtube.  I have copied his code where possible however some of the code he used has been deprecated, namely: </p>
  
  <pre><code>noteViewModel = ViewModelProviders.of(this).get(NoteViewModel.class);   
  </code></pre>
  
  <p>First I tried using the following as suggested in other posts, however this didn't work.</p>
  
  <pre><code>noteViewModel = new ViewModelProvider(this).get(NoteViewModel.class);
  </code></pre>
  
  <p>Eventually I found this next line worked for me.</p>
  
  <pre><code>noteViewModel = new ViewModelProvider(this, ViewModelProvider.AndroidViewModelFactory
              .getInstance(this.getApplication())).get(NoteViewModel.class);
  </code></pre>
  
  <p>This had been working for me, but now I have carried on the tutorials (I am now on part 7) My app is crashing. This occurs when I try to save a new note. I have compared my code to the code provided and the above line is the only difference. Below is the link to tutorial website where you can find the code.</p>
  
  <p><a href="https://codinginflow.com/tutorials/android/room-viewmodel-livedata-recyclerview-mvvm/part-7-add-note-activity" rel="nofollow noreferrer">https://codinginflow.com/tutorials/android/room-viewmodel-livedata-recyclerview-mvvm/part-7-add-note-activity</a></p>