setTextViewText not updating widget

后端 未结 1 1642
一个人的身影
一个人的身影 2020-12-11 17:45

Shown below is a simplified version of my class. I am having trouble in the onReceive method which isn\'t updating the widget TextView. It shows the correct information in

相关标签:
1条回答
  • 2020-12-11 17:59

    Found the answer. After calling the remoteViews.setTextViewText you need to update the widget with a call to updateAppWidget. The code I added is shown below.

    AppWidgetManager manager = AppWidgetManager.getInstance(context);
    manager.updateAppWidget(thisWidget, remoteViews);
    
    0 讨论(0)
提交回复
热议问题