Code example for RemoteViews

0
	/** 
	 * Update the widget 
	 */ 
	@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
	public void updateAppWidget(final Context context, final AppWidgetManager appWidgetManager, final int appWidgetId) {
		final RemoteViews views = new RemoteViews(context.getPackageName(), this.mLayoutId);
		final int idFavori = WidgetConfigureActivity.getFavoriIdFromWidget(context, appWidgetId);
		final Favori favori = sFavoriManager.getSingle(context.getContentResolver(), idFavori);
 
		// Initialisation du nombre d'horaires 
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
			final Bundle bundle = appWidgetManager.getAppWidgetOptions(appWidgetId);
			mHoraireLimit = getHorairesCount(context, bundle);
		} else { 
			if (mHoraireLimit == -1) {
				mHoraireLimit = context.getResources().getInteger(mHoraireLimitRes);
			} 
		} 
 
		if (favori != null) {
			prepareWidgetView(context, views, favori, appWidgetId);