Custom notification: java.lang.RuntimeException: bad array lengths

99封情书 提交于 2019-12-01 02:24:32

If you're seeing this issue, investigate the size of the Bitmap that you're using for the notification image.

If it's too large you may see this error, as well as an OutOfMemoryError on the Android system side.

user1026605

Ok, so I finally find the solution.

You cannot re-use the same RemoteView object like I did!

I was creating the RemoteView in the onCreate() method, then I was setting its attributes in notifyUpdateProgress().

If I create the object in notifyUpdateProgress() just before using it, I'm not having exception anymore.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!