Transformations.map With ViewModel And LiveData In Androidx (issue)
I have the above project, based on this:
https://firebase.googleblog.com/2017/12/using-android-architecture-components_20.html
and I'm having this image issues:
https://drive.google.com/drive/folders/1_M3KBZnFXkX6I1dMNLejNZAAqrs_QBA9?usp=sharing
Can someone help?
Answer
You have imported the wrong function type. it should be androidx.arch.core.util.Function and not import java.util.function.Function
In your Activity: if your ViewModel is kotlin you should reference the livedata like hotStockViewModel.hotStockLiveData since it's a property.
On JVM the properties such as "hotStockLiveData" will have a "get HotStockLiveData" and "setHotStockLiveData" which from kotlin is called like hotStockViewModel.hotStockLiveData, but in JAVA you may use hotStockViewModel.getHotStockLiveData() That's why you can't define a "getHotStockLiveData()" function in the viewModel.
Related Questions
- → How can I query Firebase for an equalTo boolean parameter?
- → How can I access nested data in Firebase with React?
- → Firebase simple blog (confused with security rules)
- → Removing item in Firebase with React, re-render returns item undefined
- → AngularJS Unknown Provider Error (Firebase & AngularFire)
- → How do you pass top level component state down to Routes using react-router?
- → "this" is null in firebase query function in reactjs
- → Angular Module Failed to Load
- → Multiple dex files define Lcom/google/android/gms/internal/zzrx;
- → Joining Firebase tables in React
- → How can I make add firepad to my reactjs project?
- → How to use Cloud Functions for Firebase to prerender pages for SEO?
- → React.js component has null state?