Code example for AppWidgetHost

Methods: createView

    public Object instantiateItem(View collection, int position) {
        int widgetId = widgetIds[position];
        AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(widgetId);
        hostViews[position] = mAppWidgetHost.createView(mContext, widgetId, appWidgetInfo);
        hostViews[position].setAppWidget(widgetId, appWidgetInfo);
        ((ViewPager) collection).addView(hostViews[position], 0);
        return hostViews[position];
     * Remove a page for the given position. The adapter is responsible for 
     * removing the view from its container, although it only must ensure this 
     * is done by the time it returns from {@link #finishUpdate()}. 
     * @param container The containing View from which the page will be removed. 
     * @param position The page position to be removed.