Last active
August 29, 2015 14:14
-
-
Save dmitriy-chernysh/061539eb31ea41539dc8 to your computer and use it in GitHub Desktop.
Android Widget UI Update
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
public class Widget extends AppWidgetProvider { | |
@Override | |
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { | |
super.onUpdate(context, appWidgetManager, appWidgetIds); | |
final int countWidgets = appWidgetIds.length; | |
for (int i = 0; i < countWidgets; i++) { | |
int appwidgetId = appWidgetIds[i]; | |
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout); | |
//TODO: update UI | |
//... | |
//update widget | |
appWidgetManager.updateAppWidget(appwidgetId, remoteViews); | |
} | |
} | |
// other methods | |
//.... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment