Radu Dan
Radu Dan

Reputation: 553

RemoteViews - void method setRemoteAdapter

I'm trying to implement a widget, with a layout that has a GridView. My onUpdate method inside the widget class is:

@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
        int[] appWidgetIds) {

    final int N = appWidgetIds.length;
    for (int i=0; i<N; i++) {
        int widgetId = appWidgetIds[i];

        RemoteViews views = new RemoteViews(context.getPackageName(),
                R.layout.widget);

                    /**views.setRemoteAdapter(..)**/

        Intent intent = new Intent(context, MainAppDelegate.class);


        appWidgetManager.updateAppWidget(widgetId, views);
    }
}

The thing is that when I call views.setRemoteAdapter(..) java doesn't know what method it is. Why is that happening? Do I need to upgrade the sdk? Also, it doesn't recognise setBundle() method

Upvotes: 1

Views: 2469

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006574

setRemoteAdapter() is only available on API Level 11. You need to have your build target set to API Level 11 or higher to compile using this method, and you need to take care to ensure that this code then only runs on API Level 11 or higher devices.

Upvotes: 4

Related Questions