Open ampedNinja opened 3 years ago
Can work around issue by keeping a reference to the RemoteViews
object, and overriding onResourceReady
to call to update the widget via AppWidget.updateAppWidget(...)
with a RemoteViews(rvLandscape, rvPortrait)
object. If you try to provide a RemoteViews
map to AppWidget.updateAppWidget(...)
that doesn't match the original constructors composition, crash will occur.
Crash when passing multiple
RemoteViews
for landscape/portrait toupdateAppWidget
.https://github.com/ampedNinja/appwidget_demo
Glide Version: 4.9.0
Integration libraries: OkHttp3
Device/Android Version: Pixel 5 11.0 and Zenfone 8 11.0
Issue details / Repro steps / Use case background: I'm creating an
appWidget
for the home screen where I must pass separateRemoteViews
objects for landscape and portrait mode. However when I implement this, there's a crash on Glide. The layout is a bit complicated, with different layouts being used depending on how much space is available, so on resizing the widget, I choose the best layout for landscape, and the best for portrait.This crash doesn't happen if I remove setting the imageview bitmap with glide and pass
updateAppWidget
RemoteViews(RemoteViews landscape, RemoteViews portrait)
or if I use glide but only pass a single RemoteViews toappWidgetManager.updateAppWidget
I've attached a simplified demo project.
AppWidget.kt:
Layout XML:
Stack trace / LogCat: