Exemple #1
0
        private RemoteViews BuildUpdate(Context context, int[] appWidgetIds)
        {
            RemoteViews updateViews = new RemoteViews(context.PackageName, Resource.Layout.widget);

            Intent i = new Intent(context, typeof(AppWidget));

            i.SetAction(AppWidgetManager.ActionAppwidgetUpdate);
            i.PutExtra(AppWidgetManager.ExtraAppwidgetIds, appWidgetIds);

            PendingIntent pi = PendingIntent.GetBroadcast(context, 0, i, PendingIntentFlags.UpdateCurrent);

            updateViews.SetImageViewResource(Resource.Id.left_die, IMAGES[(int)(Math.Random() * 6)]);
            updateViews.SetOnClickPendingIntent(Resource.Id.left_die, pi);

            updateViews.SetImageViewResource(Resource.Id.right_die, IMAGES[(int)(Math.Random() * 6)]);
            updateViews.SetOnClickPendingIntent(Resource.Id.right_die, pi);

            updateViews.SetOnClickPendingIntent(Resource.Id.background, pi);

            return(updateViews);
        }