Android widget not updating - has incorrect widget ID

前端 未结 3 1539
说谎
说谎 2021-01-17 16:56

I\'ve been working on a widget and making some advances (I hope) but still can\'t get it to do what I want.

I have a configurator activity which works ok. When it cl

3条回答
  •  佛祖请我去吃肉
    2021-01-17 17:40

    In your function updateAppWidget go to this line:

    PendingIntent widgetPendingIntent = PendingIntent.getBroadcast(context, 0, widgetIntent, 0);
    

    ...and change it into:

    PendingIntent widgetPendingIntent = PendingIntent.getBroadcast(context, appWidgetId, widgetIntent, 0);
    

提交回复
热议问题