AppWidgetProvider public void onEnabled (Context context) does not effect widget

前端 未结 2 1256
再見小時候
再見小時候 2020-12-22 07:21

I am using an AppWidgetProvider and attempting to override the onEnabled which I assume is what is called when the app gets added to the home screen from the user. My AppWid

2条回答
  •  一生所求
    2020-12-22 07:56

    The buildRemoteViews() method isn't how you get a RemoteViews object in a widget; use a constructor instead.

    RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.appwidget_provider_layout);
    

    No offense, but this is pretty clearly laid in the example in the API guide for App Widgets.

提交回复
热议问题