7

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

HenricF
  • 218
  • 3
  • 19
holtaf
  • 787
  • 6
  • 19
  • Please describe where and how you are trying to "get View instance from RemoteViews". Are you writing your own home screen? – CommonsWare Oct 10 '11 at 14:35
  • No, I am writing it in AppwidgetProvider. (actually class that extends AppwidgetProvider) – holtaf Oct 10 '11 at 14:41

2 Answers2

5

If you are the one creating the RemoteViews to hand to something else -- as is the case with an AppWidgetProvider -- you cannot "get View instance from RemoteViews". The View hierarchy created from your RemoteViews is created in a different process than your own, and so you do not have direct access to it.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
2

You can use something like:

remoteViews.setTextViewText(R.id.widget_anything, "Anytext");
Tobias
  • 7,282
  • 6
  • 63
  • 85