Today I ran into an interesting problem with custom Notifications. The following error kept on being thrown while I was testing with a Samsung Galaxy Ace phone:
“android.widget.RemoteViews$ActionException: can’t find view: …”
My custom Notification contains an ImageView and some TextViews. The image for the ImageView was being loaded from a remote server. When the image was retrieved I tried updating the Notification by modifying a clone of the original Notification I sent, calling:
- RemoteView.setImageViewBitmap(myViewId, bitmap)
After this the app would crash. The LogCat output would then show the error above.
Having a close look at the other Notifications displayed by the phone, it turned out that ImageViews were automatically removed.
To solve the issue you have to make sure to always create a new Notification, that way your custom XML gets inflated and the ImageView is (again) accessible.