List of usage examples for android.appwidget AppWidgetManager getAppWidgetIds
public int[] getAppWidgetIds(ComponentName provider)
From source file:Main.java
public static int[] getAppWidgetIds(AppWidgetManager appWidgetManager, Context context, Class<?> clazz) { return appWidgetManager.getAppWidgetIds(new ComponentName(context, clazz)); }
From source file:Main.java
public static int[] getAppWidgetIds(final Context context, final AppWidgetManager appWidgetManager, final Class<? extends AppWidgetProvider> widgetProviderClass) { ComponentName thisAppWidget = new ComponentName(context.getPackageName(), widgetProviderClass.getName()); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisAppWidget); return appWidgetIds; }
From source file:com.dycody.android.idealnote.BaseActivity.java
/** * Notifies App Widgets about data changes so they can update theirselves *///from w w w . j a va2s . c o m public static void notifyAppWidgets(Context context) { // Home widgets AppWidgetManager mgr = AppWidgetManager.getInstance(context); int[] ids = mgr.getAppWidgetIds(new ComponentName(context, ListWidgetProvider.class)); Log.d(Constants.TAG, "Notifies AppWidget data changed for widgets " + Arrays.toString(ids)); mgr.notifyAppWidgetViewDataChanged(ids, R.id.widget_list); // Dashclock LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent(Constants.INTENT_UPDATE_DASHCLOCK)); }
From source file:com.gelakinetic.inboxwidget.InboxCheckerAppWidgetConfigure.java
/** * @param context A context to build the intent with * @return An Intent which will call onUpdate for all Inbox Widgets *//*from w ww . ja v a2s .c om*/ private static Intent getUpdateWidgetIntent(Context context) { /* Get an intent for the InboxCheckerAppWidgetProvider class */ Intent intent = new Intent(context.getApplicationContext(), InboxCheckerAppWidgetProvider.class); /* Tell it to update widgets */ intent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE); /* Get a list of IDs for all the widgets */ AppWidgetManager widgetManager = AppWidgetManager.getInstance(context); int[] ids = widgetManager.getAppWidgetIds(new ComponentName(context, InboxCheckerAppWidgetProvider.class)); /* Tell the intent which widgets to update */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { widgetManager.notifyAppWidgetViewDataChanged(ids, android.R.id.list); } intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids); /* Return the intent */ return intent; }
From source file:ch.fixme.status.Widget.java
public static void UpdateAllWidgets(final Context ctxt) { AppWidgetManager man = AppWidgetManager.getInstance(ctxt); int[] ids = man.getAppWidgetIds(new ComponentName(ctxt, Widget.class)); Intent ui = new Intent(); ui.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE); ui.putExtra(Widget.WIDGET_IDS, ids); ui.putExtra(Widget.WIDGET_FORCE, true); ctxt.sendBroadcast(ui);/* w w w . j av a 2 s. com*/ }
From source file:org.gnucash.android.ui.widget.WidgetConfigurationActivity.java
/** * Updates all widgets belonging to the application * @param context Application context/* ww w . j a v a 2s.c o m*/ */ public static void updateAllWidgets(Context context) { Log.i("WidgetConfiguration", "Updating all widgets"); AppWidgetManager widgetManager = AppWidgetManager.getInstance(context); ComponentName componentName = new ComponentName(context, TransactionAppWidgetProvider.class); int[] appWidgetIds = widgetManager.getAppWidgetIds(componentName); SharedPreferences defaultSharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); for (int widgetId : appWidgetIds) { long accountId = defaultSharedPrefs.getLong(UxArgument.SELECTED_ACCOUNT_ID + widgetId, -1); if (accountId <= 0) continue; updateWidget(context, widgetId, accountId); } }
From source file:org.gnucash.android.ui.homescreen.WidgetConfigurationActivity.java
/** * Updates all widgets belonging to the application * @param context Application context/*from w w w .j a v a2 s . com*/ */ public static void updateAllWidgets(final Context context) { Log.i("WidgetConfiguration", "Updating all widgets"); AppWidgetManager widgetManager = AppWidgetManager.getInstance(context); ComponentName componentName = new ComponentName(context, TransactionAppWidgetProvider.class); final int[] appWidgetIds = widgetManager.getAppWidgetIds(componentName); //update widgets asynchronously so as not to block method which called the update //inside the computation of the account balance new Thread(new Runnable() { @Override public void run() { for (final int widgetId : appWidgetIds) { updateWidget(context, widgetId); } } }).start(); }
From source file:com.tlongdev.bktf.util.Utility.java
public static void notifyPricesWidgets(Context context) { AppWidgetManager manager = AppWidgetManager.getInstance(context); int[] appWidgetIds = manager .getAppWidgetIds(new ComponentName(context.getApplicationContext(), FavoritesWidget.class)); manager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.list_view); }
From source file:br.com.bioscada.apps.biotracks.widgets.TrackWidgetProvider.java
/** * Updates all app widgets.// w w w . j av a 2s . co m * * @param context the context * @param trackId track id */ private static void updateAllAppWidgets(Context context, long trackId) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager .getAppWidgetIds(new ComponentName(context, TrackWidgetProvider.class)); for (int appWidgetId : appWidgetIds) { updateAppWidget(context, appWidgetManager, appWidgetId, trackId); } }
From source file:com.brewcrewfoo.performance.util.Helpers.java
public static void updateAppWidget(Context context) { AppWidgetManager widgetManager = AppWidgetManager.getInstance(context); ComponentName widgetComponent = new ComponentName(context, PCWidget.class); int[] widgetIds = widgetManager.getAppWidgetIds(widgetComponent); Intent update = new Intent(); update.setAction("com.brewcrewfoo.performance.ACTION_FREQS_CHANGED"); update.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, widgetIds); context.sendBroadcast(update);/*from w w w . j a va2 s . c om*/ }