我们最近已将应用迁移到Room。新屏幕计划使用LiveData,旧屏幕仍将使用ContentProvider和CursorLoader。但是某些装载机有问题。更新数据库(通过同步更改属性)时,将调用onLoadFinished,但使用旧数据。仅在恢复活动后,才会使用新数据调用onLoadFinished。这发生在任何人身上吗?
游标来自支持库v.26。这些是添加到app.gradle的新依赖项:
archLifecycleVersion = "1.1.1"
implementation "android.arch.persistence.room:runtime:$rootProject.archLifecycleVersion"
implementation "android.arch.persistence.room:rxjava2:$rootProject.archLifecycleVersion"
kapt "android.arch.persistence.room:compiler:$rootProject.archLifecycleVersion"
annotationProcessor "android.arch.persistence.room:compiler:$rootProject.archLifecycleVersion"
testImplementation "android.arch.persistence.room:testing:$rootProject.archLifecycleVersion"
// ViewModel and LiveData
implementation "android.arch.lifecycle:extensions:$rootProject.archLifecycleVersion"
implementation "android.arch.lifecycle:common-java8:$rootProject.archLifecycleVersion"
编辑:这在模拟器和某些设备上发生