#StackBounty: #android #kotlin #android-livedata How to access each element of LiveData<List<MVoice>> with Kotlin?

Bounty: 50

The Code A use for (aMovice in listVoiceBySort.value!!) to access each element of LiveData<List<MVoice>>.

But I don’t think it’s a good way because it uses listVoiceBySort.value!!, it’s ugly.

Is there a good way to access each element of LiveData<List<MVoice>>?

Code A

 val listVoiceBySort: LiveData<List<MVoice>> =_listVoiceBySort

 fun selectAllIDs(){
   for (aMovice in listVoiceBySort.value!!){

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.