In this video, Emmanuel Henri explores what the AppWidgetProvider class is and its use in your widget project.
- [Instructor] Now, let's move on to the provider classes … and explore what they are, and how we can use them. … The first one is onUpdate; this class is called … to update the widget based on the milliseconds you set … in the info file we explored in the last video. … This allows you to update the widget, … and this class is called whenever the user adds the widget. … The next method is called onEnabled, which is called … the first time the widget is created. … So whatever code you put in there will be executed … when the user place a new widget on the screen. … Then we have a method called onDisabled, … which is when a user removes a widget from its screen. … For example, if you create a mini database … or some (mumbles) data, upon creation, … this is when you'd remove these items … and use this method to do so. … And finally you have onAppWidgetOptionsChanged, … this is a method that is called … whenever the widget is resized or when placed on the screen. … So if we take a look into our current code, …
- Design guidelines for Android widgets
- Creating the widget layout
- Working with the AppWidgetProvider class
- Adding functionality with provider functions
- Pinning app widgets