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!!){
selectedIDs.add(aMovice.id)
}
}