How to start Activity from Android AppWidget?

后端 未结 3 1311
眼角桃花
眼角桃花 2021-01-11 13:48

Code like this works well.

    Intent configIntent = new Intent (context, WidgetConfigActivity.class);
    configIntent.putExtra(AppWidgetManager.EXTRA_APPWI         


        
3条回答
  •  余生分开走
    2021-01-11 14:24

    Problem is that I can't use startActivity() function in AppWidget.

    Yes, you can. You are passed in a Context object into onUpdate() (or onReceive()) of your AppWidgetProvider -- call startActivity() on that.

提交回复
热议问题