List of usage examples for android.appwidget AppWidgetManager getAppWidgetInfo
public AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId)
From source file:com.piusvelte.sonet.core.StatusDialog.java
private String[] getAllWidgets() { mAppWidgetIds = new int[0]; // validate appwidgetids with appwidgetmanager AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(this); mAppWidgetIds = Sonet.getWidgets(getApplicationContext(), appWidgetManager); // older versions had a null widget, remove them this.getContentResolver().delete(Widgets.getContentUri(StatusDialog.this), Widgets.WIDGET + "=?", new String[] { "" }); this.getContentResolver().delete(Widget_accounts.getContentUri(StatusDialog.this), Widget_accounts.WIDGET + "=?", new String[] { "" }); String[] widgetsOptions = new String[mAppWidgetIds.length]; for (int i = 0; i < mAppWidgetIds.length; i++) { AppWidgetProviderInfo info = appWidgetManager.getAppWidgetInfo(mAppWidgetIds[i]); String providerName = info.provider.getClassName(); widgetsOptions[i] = Integer.toString(mAppWidgetIds[i]) + " (" + providerName + ")"; }//ww w . jav a2 s . c o m return widgetsOptions; }
From source file:com.shafiq.myfeedle.core.StatusDialog.java
private String[] getAllWidgets() { mAppWidgetIds = new int[0]; // validate appwidgetids with appwidgetmanager AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(this); mAppWidgetIds = Myfeedle.getWidgets(getApplicationContext(), appWidgetManager); // older versions had a null widget, remove them this.getContentResolver().delete(Widgets.getContentUri(StatusDialog.this), Widgets.WIDGET + "=?", new String[] { "" }); this.getContentResolver().delete(Widget_accounts.getContentUri(StatusDialog.this), Widget_accounts.WIDGET + "=?", new String[] { "" }); String[] widgetsOptions = new String[mAppWidgetIds.length]; for (int i = 0; i < mAppWidgetIds.length; i++) { AppWidgetProviderInfo info = appWidgetManager.getAppWidgetInfo(mAppWidgetIds[i]); String providerName = info.provider.getClassName(); widgetsOptions[i] = Integer.toString(mAppWidgetIds[i]) + " (" + providerName + ")"; }/*ww w . ja v a 2 s. c o m*/ return widgetsOptions; }