11

Is it possible to use data binding on custom Android notification layouts? I'm making a custom Android notification layout using RemoteViews as described here.

We usually use data binding on our layouts, but it requires inflating it with

DataBindingUtil.inflate(context, R.layout.myLayout, ...)

But when using RemoteViews, it isn't generally inflated, its just instantiated as:

RemoteViews smallContentView = new RemoteViews(packageName, R.layout.notification);

Is there a method of DataBindingUtil or RemoteViews to allow data binding?

ScottyC
  • 1,467
  • 1
  • 15
  • 22
  • 1
    Do you find solution, I'm in same case – LaurentY Oct 27 '17 at 14:15
  • 1
    No I didn't. And I concluded that it might be by design: that it isn't possible because once the notification is sent to the system to be displayed, it's no longer owned/run by our app/process, the system owns it. I think you theoretically COULD implement data binding for notifications (or more specifically, RemoteViews), but if it ever was implemented it would be incredibly inefficient because any data-bound UI updates would still require re-sending the whole notification to the system again. – ScottyC Oct 30 '17 at 19:52

0 Answers0