我想点击小部件TextView
时启动活动,但有些我无法做到这一点。
这是我的代码。
RemoteViews remoteViews = new RemoteViews(context.getPackageName(),R.layout.safehub_widget);
Intent intent = new Intent(context, MyActivity.class);
// intent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
PendingIntent pIntent = PendingIntent.getBroadcast(context,
0, intent,0);
Log.e("widget" , "clicking set");
remoteViews.setOnClickPendingIntent(R.id.wFollowMeText, pIntent);
ComponentName thisWidget = new ComponentName(context, MyWidget.class);
AppWidgetManager.getInstance(context).updateAppWidget(thisWidget, remoteViews);