Launching activity from widget

后端 未结 9 1177
深忆病人
深忆病人 2020-11-29 00:26

I\'m trying to do something which really ought to be quite easy, but it\'s driving me crazy. I\'m trying to launch an activity when a home screen widget is pressed, such as

9条回答
  •  伪装坚强ぢ
    2020-11-29 01:08

    I just wanted to note this here somewhere as I have been (quite stupidly) battling this all night. Basically I did all the intent code correctly but nothing would be launched.

    The problem was that I accidentally had a call like this

    super.onUpdate(context, appWidgetManager, appWidgetIds);
    

    at the end of my Overridden onUpdate() function.

    Make sure you DO NOT have this call to super as it will clear out all pending intents you've set up!

提交回复
热议问题