Code example for RemoteViews

Methods: setViewVisibility

0
	 * @param visible 
	 * @param layoutId 
	 * @param widgetClass 
	 */ 
	public static void setVisibility(Context context, int componentResId, boolean visible, int layoutId, Class<?> widgetClass) {
		RemoteViews view = new RemoteViews(context.getPackageName(), layoutId);
		int vis;
		if (visible) {
			vis = View.VISIBLE;
		} else { 
			vis = View.GONE;
		} 
		view.setViewVisibility(componentResId, vis);	
		AppWidgetManager man = AppWidgetManager.getInstance(context);
		ComponentName widget = new ComponentName(context.getApplicationContext(), widgetClass);
		man.updateAppWidget(widget, view);
	} 
	 
	/** 
	 *  
	 * Static method to set the text color of a TextView in a widget.