代码编写如下:
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);
我已经获得了Ids小部件应用程序test.widgets
答案 0 :(得分:2)
以这种方式使用:
AppWidgetManager manager = AppWidgetManager.getInstance(context);
int[] ids = manager.getAppWidgetIds(new ComponentName(context,
Widget1x2.class));
这应该有用。