sjthn
08/10/2019, 5:38 PMprivate val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
presenter = ProductPresenter(ProductRepository(Network(), Database()), scope)
button_fetch.setOnClickListener {
presenter.onFetchClick()
}
}
---------------------------------------------------------------------
fun onFetchClick() {
loadingState.value = true
scope.launch {
//...
}
}louiscad
08/10/2019, 5:40 PMThread.UncaughtExceptionHandler that you set in the onCreate method of your Application class (that you need to register in the manifest). I encountered such issues in the past where crash cause didn't show and that's how I worked around it until I saw double logs again.sjthn
08/10/2019, 5:40 PMGlobalScope it's working finesjthn
08/10/2019, 5:50 PMkotlinx-coroutines-android dependency. That caused the uncaught exception 🙂 .
A lint warning would have saved time. Thanks @louiscadlouiscad
08/10/2019, 9:11 PMsjthn
08/13/2019, 5:39 AM