public int [ ] createWidgets ( Class < ? extends AppWidgetProvider > appWidgetProviderClass , int widgetLayoutId , int howManyToCreate ) { AppWidgetProvider appWidgetProvider = ReflectionHelpers . callConstructor ( appWidgetProviderClass ) ; int [ ] newWidgetIds = new int [ howManyToCreate ] ; for ( int i = 0 ; i < howManyToCreate ; i ++ ) { View widgetView = createWidgetView ( widgetLayoutId ) ; int myWidgetId = nextWidgetId ++ ; widgetInfos . put ( myWidgetId , new WidgetInfo ( widgetView , widgetLayoutId , appWidgetProvider ) ) ; newWidgetIds [ i ] = myWidgetId ; } appWidgetProvider . onUpdate ( context , realAppWidgetManager , newWidgetIds ) ; return newWidgetIds ; }
Creates a bunch of widgets by inflating the same layout multiple times .