Ahmad Aghazadeh
Ahmad Aghazadeh

Reputation: 17131

How to get widget id another application?

Code is written as follows:

Intent widget = new Intent(
        "test.widgets.Widget1x2");
widget.setAction("android.appwidget.action.APPWIDGET_UPDATE");

ComponentName name = new ComponentName(
        "test.widgets", "Widget1x2");

int[] ids = AppWidgetManager.getInstance(context)
        .getAppWidgetIds(name);

I have get Ids widgets application test.widgets

Upvotes: 0

Views: 213

Answers (1)

vmayatskii
vmayatskii

Reputation: 144

Use it this way:

AppWidgetManager manager = AppWidgetManager.getInstance(context);
int[] ids = manager.getAppWidgetIds(new ComponentName(context,
                Widget1x2.class));

This should work.

Upvotes: 2

Related Questions