code: 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;
    }
docs: Creates a bunch of widgets by inflating the same layout multiple times.
  
  @param appWidgetProviderClass the app widget provider class
  @param widgetLayoutId         id of the layout to inflate
  @param howManyToCreate        number of new widgets to create
  @return the IDs of the new widgets