I was using the binance API with retrofit so I was receiving an array with the data, mapping to my custom UI object and uploading all in the recyclerView over 2/3 seconds with liveData
LiveData in the fragment
viewModel.cryptoListLD.observe(viewLifecycleOwner){ cryptoAdapter.setData(it) }
RecyclerViewAdapter
fun setData(cryptos: List<CryptoUI>){
cryptoList = cryptos
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
with(holder){
setImg(cryptoList[position].imgUrl)
setSymbol(cryptoList[position].Symbol)
setName(cryptoList[position].name)
setPrice(cryptoList[position].price)
setPriceVariation(cryptoList[position].priceVariation)
}
}
Now, I want to know if it's possible to update only some part of the recyclerView card, and not all the item because I want to implement some call to the binance web socket that returns a lot of data per second and I don't want to overload the performance.
In this case, I want to update only the price and the variation, but maintain the same image and name.
