Android ViewModel and ViewModel Factory Tutorial for Beginners with Example

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 5

  • @ahmadxrizvi
    @ahmadxrizvi Год назад

    Great video can you make one on Couroutines please?

  • @lucatae9599
    @lucatae9599 Год назад

    thnx for the video.. but im not able to add my factory as a parameter inside the viewModelProvider.. "None of the following functions can be called with the arguments supplied" this is what the error message is.. can you please help?

    • @danieltalkscode
      @danieltalkscode  Год назад

      Hi Luca, how are you defining your factory? Is your ViewModel Factory implementing the ViewModelProvider.Factory interface? Also how are you creating your view model within your fragment code? You'll want to pass two arguments. The first argument is "this" which refers to the fragment you're in. The second is the factory. Let me know if this helps.