android Appwidget单击事件触发

@Override

public void onUpdate(Context context, AppWidgetManager appWidgetManager,
            int[] appWidgetIds) {

super.onUpdate(context, appWidgetManager, appWidgetIds);

final int N = appWidgetIds.length;

  for(int i=0; i<N;i++){

  int appWidget = appWidgetIds[i];

  Intent intent = new Intent();

  intent.setClass(context, MainActivity.class);

  PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);

  RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.AppWidgetLayout);

  views = updateViews(context);

appWidgetManager.updateAppWidget(appWidget, views);

  }

 

}

os:Android 2.2

since:2011/8/8

@author william lee

ps:中文输入可能存在问题,请不要copy,有错误,有可能 !

你可能感兴趣的:(appwidget)