当我们点击该窗口小部件时,我需要打开活动屏幕(或应用程序).如何做到这一点?
解决方法
您需要在您的窗口小部件上设置一个onClickpendingIntent
Intent intent = new Intent(context,ExampleActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(context,intent,0); // Get the layout for the App Widget and attach an on-click listener to the button RemoteViews views = new RemoteViews(context.getPackageName(),R.layout.appwidget_provider_layout); views.setOnClickPendingIntent(R.id.button,pendingIntent);@H_403_7@看一下这个