Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps(更新大量小部件位图时避免 FAILED BINDER TRANSACTION 错误)
问题描述
我在 AppWidget 中更新 RemoteViews 时遇到错误.
I am coming across an error when I am updating my RemoteViews in my AppWidget.
.. !!!Binder 交易失败!!!
.. !!! FAILED BINDER TRANSACTION !!!
这是因为对 RemoteViews 的所有更改都是序列化的(例如 setInt 和 setImageViewBitmap ).位图也被序列化成一个内部包.不幸的是,这个捆绑包的大小限制非常小.
This is caused because all the changes to the RemoteViews are serialised (e.g. setInt and setImageViewBitmap ). The bitmaps are also serialised into an internal bundle. Unfortunately this bundle has a very small size limit.
我不能使用 setImageResource,因为我希望允许用户下载小部件的皮肤.
I cannot use setImageResource as I am hoping to allow the user to download skins for the widget.
谁能推荐一个解决这个问题的方法?我已经为小部件的每个实例使用了一个新"RemoteViews 对象,但是单个实例包含太多更新.
Can anyone recommend a workaround for this problem? I am already using a "new" RemoteViews object for each instance of the widget, but a single instance contains too many updates.
谢谢!
推荐答案
我发现的最佳解决方法是在 ImageView
对象上使用 setImageURI
The best workaround I found was to use setImageURI
on the ImageView
objects using
remoteViews.setUri(R.id.myImageView, "setImageURI", "file://blahblahblah.png");
这是来自 Android 开发者组的完整讨论
这篇关于更新大量小部件位图时避免 FAILED BINDER TRANSACTION 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:更新大量小部件位图时避免 FAILED BINDER TRANSACTION 错误


基础教程推荐
- 如何使用 YouTube API V3? 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- 固定小数的Android Money Input 2022-01-01
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01