public class StockViewModel extends ViewModel {
private final MutableLiveData entropy = new MutableLiveData<>(new Entropy());
private AlphaVantageService alphaVantageService;
private NewsApiService newsApiService;
public StockViewModel() {
alphaVantageService = RetrofitClient.getAlphaVantageService();
newsApiService = RetrofitClient.getNewsApiService();
}
@Bindable
public LiveData<Entropy> getEntropy() {
return entropy;
}
I’ve tried just about everything. The idea is it’s supposed to make an api call, use the metadata to retrieve a name, and use the name as an ID…
<TextView
android:id="@+id/tv_stock_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{stockViewModel.entropy.stockName != null ? stockViewModel.entropy.stockName : @string/default_stock_name}"
android:textSize="18sp"
android:textStyle="bold" />