MindorksOpenSource/Kotlin-Flow-Android-Examples

error occurred after opening search

deepajais95 opened this issue · 1 comments

android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:7087)
at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:1085)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:4829)
at android.view.View.invalidateInternal(View.java:11990)
at android.view.View.invalidate(View.java:11950)
at android.view.View.invalidate(View.java:11934)
at android.widget.TextView.checkForRelayout(TextView.java:7170)
at android.widget.TextView.setText(TextView.java:4114)
at android.widget.TextView.setText(TextView.java:3966)
at android.widget.TextView.setText(TextView.java:3941)
at com.mindorks.kotlinFlow.learn.search.SearchActivity$setUpSearchStateFlow$1$invokeSuspend$$inlined$filter$1$2.emit(Collect.kt:137)
at kotlinx.coroutines.flow.FlowKt__DelayKt$debounce$2$invokeSuspend$$inlined$select$lambda$2.invokeSuspend(Delay.kt:66)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

image

Use main thread to modify view hierarchy.