I am trying to render a RemoteViews instance onto a Canvas, like I do with a regular View. I use
RemoteViews.apply(context, null)
and it returns a FrameLayout with all the views nested and properly measured (location and size is correct,) but after using .draw on the returned view, it renders all elements with no values -- TextViews are empty, AnalogClock is reset at 00:00 and so on.
Any ideas? I'm lost :(
Not sure if the question is still actual. Nevertheless here is my experience with RemoveViews. It appears you cannot just call
draw()
on the returned view. You have to add this view to a parent container to make it a part of global view hierarchy. For instance, you have anActivity
with a singleFrameLayout
in it. Your code will look like this.Now you should be able to see tests. If you set listeners, they will work properly too.