ViewModelProviders.of(this) is deprecated what to use instead ViewModelProviders.of(this) OR if you don't want to use ViewmodelFactory OR ViewModelProviders error.

 The problem:- 

1) Solution to Deprecated method ViewModelProviders#of 
2) As ViewModelProviders.of() is deprecated, How should i create object of ViewModel? 
3) Deprecated ViewModelProviders!
4) Remove deprecated ViewModelProviders.


 Try this:
 ViewModelProviders viewModel = ViewModelProviders.of(this)
            .get(AddActivityViewModel.class); // deprecated 

Change to this:
ViewModelProvider viewModel= new 
     ViewModelProvider(this).get(AddActivityViewModel.class); // New



Search By:

viewmodelproviders.of deprecated java   
android viewmodelprovider example  
viewmodelprovider example  
viewmodelproviders androidx  
viewmodelproviders.of(this) error 
viewmodelproviders.of activity  
viewmodelprovider(viewmodelstoreowner) viewmodelprovider factory  
android viewmodelprovider





Comments

Post a Comment

Popular posts from this blog

Lint found fatal errors while assembling a release target.

Windows 7 all Version 64-Bit iso file Download with crack activation. (Google Drive Link)