Created
July 5, 2020 15:50
-
-
Save amalhanaja/6fef442c1507da596c6c89f26cb39fd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun updateWidget(context: Context) { | |
val appWidgetManager = AppWidgetManager.getInstance(context) | |
val favoriteAppWidget = ComponentName(context, FavoriteAppWidget::class.java) | |
val widgetIds = appWidgetManager.getAppWidgetIds(favoriteAppWidget) | |
val intent = Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE) | |
.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, widgetIds) | |
context.sendBroadcast(intent) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment