@Override public void onReceive(Context context, Intent intent) { Log.d("ExmampleBroadcastReceiver", "intent=" + intent); // For our example, we'll also update all of the widgets when the timezone // changes, or the user or network sets the time. String action = intent.getAction(); if (action.equals(Intent.ACTION_TIMEZONE_CHANGED) || action.equals(Intent.ACTION_TIME_CHANGED)) { AppWidgetManager gm = AppWidgetManager.getInstance(context); ArrayList<Integer> appWidgetIds = new ArrayList<>(); ArrayList<String> texts = new ArrayList<>(); ExampleAppWidgetConfigure.loadAllTitlePrefs(context, appWidgetIds, texts); final int N = appWidgetIds.size(); for (int i=0; i<N; i++) { ExampleAppWidgetProvider.updateAppWidget(context, gm, appWidgetIds.get(i), texts.get(i)); } } }
@Override public void onReceive(Context context, Intent intent) { Log.d("ExmampleBroadcastReceiver", "intent=" + intent); // For our example, we'll also update all of the widgets when the timezone // changes, or the user or network sets the time. String action = intent.getAction(); if (action.equals(Intent.ACTION_TIMEZONE_CHANGED) || action.equals(Intent.ACTION_TIME_CHANGED)) { AppWidgetManager gm = AppWidgetManager.getInstance(context); ArrayList<Integer> appWidgetIds = new ArrayList<Integer>(); ArrayList<String> texts = new ArrayList<String>(); ExampleAppWidgetConfigure.loadAllTitlePrefs(context, appWidgetIds, texts); final int N = appWidgetIds.size(); for (int i=0; i<N; i++) { ExampleAppWidgetProvider.updateAppWidget(context, gm, appWidgetIds.get(i), texts.get(i)); } } }