小编Adh*_*mal的帖子

SingletonComponent 缺少父声明

我刚刚更新我的Android希尔特匕首的依赖关系到1.0.0-alpha03
和我身材ApplicationComponent弃用
,取而代之的 ,但一旦我在我的代码替换它显示了这个错误我是否需要做别的任何事情,只是用它?SingletonComponent

完全错误

> Task :app:kaptDebugKotlin FAILED
error: [Hilt]
  @DefineComponent dagger.hilt.components.SingletonComponent is missing a parent declaration.
  Please declare the parent, for example: @DefineComponent(parent = ApplicationComponent.class)
  [Hilt] Processing did not complete. See error above for details.error: [Hilt]
  @DefineComponent dagger.hilt.components.SingletonComponent is missing a parent declaration.
  Please declare the parent, for example: @DefineComponent(parent = ApplicationComponent.class)
  [Hilt] Processing did not complete. See error above for details.error: [Hilt]
  @DefineComponent dagger.hilt.components.SingletonComponent is missing a parent declaration.
  Please declare …
Run Code Online (Sandbox Code Playgroud)

android dagger-hilt

25
推荐指数
2
解决办法
3415
查看次数

刷新片段回到上一个片段

这就是我的应用程序中的内容

  • 带有 ViewModel 和数据绑定的 2 个片段的活动。
  • 带有 Livedata 的房间数据库以不断更新 UI。
  • 导航控制器在片段之间导航。
  • 片段 #1 有 RecyclerView(自定义对象列表)。
  • 片段#2 是插入或更新操作(事务)。

一切都按预期正常工作,但有一件事我无法弄清楚为什么会发生。

当我转到 Fragment #2 将数据插入或更新到 Room Database 然后使用(顶部或底部)后退按钮返回 Fragment #1 时,Fragment #1 不会重新加载并且数据不会更改(更新),直到我重新加载数据.

在其他情况下,当我在同一片段插入或更新数据时,列表会立即更改。

我必须在同一个片段上进行插入和更新操作吗?

我不能在其他片段上这样做吗,当我回到列表片段时,我发现数据已更新?

请记住,它就像我希望的那样工作,但在某些时候我真的不知道它不再存在了!!

android uinavigationcontroller android-fragments android-room android-livedata

5
推荐指数
0
解决办法
334
查看次数