【问题标题】:populate widget with Firebase使用 Firebase 填充小部件
【发布时间】:2017-03-05 21:41:41
【问题描述】:

我的应用使用 Firebase 数据库,并且项目在 RecyclerView 中正确显示,但我也想在小部件中显示它们。由于小部件不是一项活动,因此我在使用 Firebase 和 ListView 时遇到了各种问题。有什么方法可以从 Firebase 填充小部件?

【问题讨论】:

标签: android listview firebase widget firebase-realtime-database


【解决方案1】:

在 onDataSetChanged() 中花费超过 20 秒从 Internet/Firebase 数据库获取数据将不会在小部件列表视图上显示数据。 您将不得不使用 CountDownLatch。

另外,这里有一个例子https://github.com/mvescovo/item-reaper

https://github.com/mvescovo/item-reaper/blob/master/app/src/main/java/com/michaelvescovo/android/itemreaper/widget/WidgetListService.java

【讨论】:

    猜你喜欢
    • 2014-07-14
    • 1970-01-01
    • 2021-11-13
    • 1970-01-01
    • 2020-07-06
    • 2012-08-06
    • 1970-01-01
    • 2011-04-07
    • 2023-03-07
    相关资源
    最近更新 更多