Launching activity from widget

后端 未结 9 1165
深忆病人
深忆病人 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 00:57

    The problem with the Toast not showing is easy, you don't call show(), a mistake I always do too... do

    Toast.makeText(context, "Hello from onUpdate", Toast.LENGTH_SHORT).show();
    

    instead of

    Toast.makeText(context, "Hello from onUpdate", Toast.LENGTH_SHORT);
    

提交回复
热议问题