public void OnAppWidgetOptionsChanged(Context context,
                                              AppWidgetManager appWidgetManager,
                                              int appWidgetId,
                                              Bundle newOptions)
        {
            RemoteViews layout = RemoteViewsFactory.CreateLayout(context, appWidgetId, newOptions);

            appWidgetManager.UpdateAppWidget(appWidgetId, layout);
        }
        public void OnUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
        {
            // Update each of the widgets with the remote adapter
            foreach (int id in appWidgetIds)
            {
                RemoteViews layout = null;

                // API 16 and above supports reconfigurable layouts
                if ((int)Build.VERSION.SdkInt >= 16)
                {
                    Bundle options = appWidgetManager.GetAppWidgetOptions(id);
                    layout = RemoteViewsFactory.CreateLayout(context, id, options);
                }
                else
                {
                    layout = RemoteViewsFactory.CreateLayout(context, id);
                }

                appWidgetManager.UpdateAppWidget(id, layout);
            }
            base.OnUpdate(context, appWidgetManager, appWidgetIds);
        }