Code example for RemoteViews

Methods: setImageViewResourcesetOnClickPendingIntentsetViewVisibility

            // SettingsAppWidgetProvider.logD(">> updateView IN. Widget: "+appWidgetId+" Button:"+buttonID); 
            // SettingsAppWidgetProvider.logD("updateView -> Is Visible"); 
            // Set it visible 
            views.setViewVisibility(buttonLayout, View.VISIBLE);
            if (buttonSep != null) {
                views.setViewVisibility(buttonSep, View.VISIBLE);
            // SettingsAppWidgetProvider.logD("updateView -> Will register Intent"); 
            // Register the Intent 
                    getLaunchPendingIntent(context, appWidgetId, buttonID));
            // SettingsAppWidgetProvider.logD("updateView -> Set current Icon"); 
            // Update icon to the one set by updateState 
            views.setImageViewResource(buttonIcon, currentIcon);
            // SettingsAppWidgetProvider.logD("updateView -> Set current State"); 
            views.setImageViewResource(buttonState, getButtonState(widgetPreferences));
     * Creates PendingIntent to notify the widget of a button click. 
Stop searching for code, let great code find you!  Add Codota to your java IDE