Kulwinder Singh
12/13/2018, 9:40 AMcoroutine
i'm getting more data for each item from network like below private fun onItemsLoaded(videosList: List<BaseVideo>) {
uiScope.launch {
val videoAndData = getUserDataForEachVideo(videosList)//suspending function
adapter.addData(videoAndData)
}
}
so here everytime whenever new 5 items loaded then new
coroutine
is created, so here over the time it will increase created coroutines , i know that coroutines are light weight but is there any other way to solve this problem where i can create a single coroutine and then run my code inside that coroutine instead of creating new coroutine everytimestreetsofboston
12/13/2018, 12:04 PMienoobong
12/14/2018, 11:24 AM