kotlin coroutines, what is the difference between coroutineScope and withContext

Formally, coroutineScope is a special case of withContext where you pass in the current context, avoiding any context switching. Schematically speaking, coroutineScope ≡ withContext(this.coroutineContext) Since switching contexts is just one of several features of withContext, this is a legitimate use case. withContext waits for all the coroutines you start within the block to complete. If … Read more

Suspend function ‘callGetApi’ should be called only from a coroutine or another suspend function

Suspend function should be called only from a coroutine. That means to call a suspend function you need to use a coroutine builder, e.g. launch, async or runBlocking(recommended to use only in unit tests). For example: class Activity : AppCompatActivity(), CoroutineScope { private var job: Job = Job() override val coroutineContext: CoroutineContext get() = Dispatchers.Main … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)