View Instance from RemoteViews

How can I get a View instance from RemoteViews ? There are API functions RemoteViews.reapply and RemoteViews.apply API, but I do not know how to use them.

+6
source share
2 answers

If you create RemoteViews to transmit something else - as is the case with AppWidgetProvider - you cannot get a View instance from RemoteViews. The View hierarchy created from your RemoteViews is created in a different process than your own, and therefore you do not have direct access to it.

+4
source

You can use something like:

 remoteViews.setTextViewText(R.id.widget_anything, "Anytext"); 
+2
source

Source: https://habr.com/ru/post/898979/


All Articles