【发布时间】:2017-05-23 06:11:44
【问题描述】:
我所做的如下:
// prepare
mAppWidgetManager = AppWidgetManager.getInstance(applicationContent);
mAppWidgetHost = new LauncherAppWidgetHost(applicationContent, R.string.app_name);
// create widget
int appWidgetId = ...; // the id of the widget, that I have saved
AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
AppWidgetHostView hostView = mAppWidgetHost.createView(context, appWidgetId, appWidgetInfo);
hostView.setAppWidget(appWidgetId, appWidgetInfo);
// show view
// now I just display the hostView
问题
在一些设备和一些小部件上,小部件在重启后会停止工作(widgetView 在重启后只是一个空视图)。任何想法为什么会发生这种情况?我已经要求我的用户在他们的家庭启动器中尝试相同的小部件,并且在重新启动后小部件也会继续工作......
【问题讨论】:
标签: android widget android-widget