kotlin, how to run sequential background threads
I want to run a function in a background thread with
Dispatcher.IO on
recycleView code like this
class FileAdapter(val isFromNetwork : Boolean, val context: Context, val tools: Tools, val coroutineScope: CoroutineScope):RecyclerView.Adapter() {
...
override fun onBindViewHolder(holder: FileHolder, position: Int) {
coroutineScope.launch{
val task =async(
Dispatchers.IO){ tools.networkFileManager(networkFileList[position]) }
task.await().let{
//some...