It’s not recommended but you can access to database on main thread with allowMainThreadQueries()
MyApp.database = Room.databaseBuilder(this, AppDatabase::class.java, "MyDatabase").allowMainThreadQueries().build()
More Related Contents:
- Room Persistence: Error:Entities and Pojos must have a usable public constructor
- How to use Data Binding and Kotlin in Android Studio 3.0.0
- Android Room – Select query with LIKE
- How can I represent a “many to many” relation with Android Room when column names are same?
- How to save enum field in the database room?
- How to make primary key as autoincrement for Room Persistence lib
- Android Kotlin: Getting a FileNotFoundException with filename chosen from file picker?
- Singleton object becomes null after app is resumed
- Why do I get “unresolved reference” error for my view’s name/ID when I type it in Kotlin?
- AndroidStudio Cannot Find Layout
- Android Studio 3.0 Execution failed for task: unable to merge dex
- Notify Observer when item is added to List of LiveData
- Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15
- Singleton with parameter in Kotlin
- Error: Execution failed for task ‘:app:clean’. Unable to delete file
- Existing 3-function callback to Kotlin Coroutines
- Pass Parcelable argument with compose navigation
- Error:Execution failed for task ‘:app:kaptDebugKotlin’
- Jetpack Compose collapsing toolbar
- Cannot find symbol DataBindingComponent on Android Studio 3.2 Canary 16 Kotlin project
- Return type for Android Room joins
- How to fix ‘Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: No outputs for the main artifact of variant:’
- How to get rid of Incremental annotation processing requested warning?
- Kotlin Android View Binding: findViewById vs Butterknife vs Kotlin Android Extension
- How to combine two live data one after the other?
- lateinit modifier is not allowed on primitive type properties in Kotlin
- Kotlin Extension Functions suddenly require api level 24
- Room Persistence lib implementation in Kotlin
- 5.1 Crash – A TaskDescription’s primary color should be opaque
- compileReleaseKotlin fails with java.lang.ClassNotFoundException: com.sun.tools.javac.util.Context