Detailed explanation of Android control appwidgetprovider usage

introduce

Appwidgetprovider is a class provided in Android to implement desktop gadgets. Its essence is a broadcast, that is, broadcastreceiver. In actual use, the appwidgetprovider can be regarded as a broadcastreceiver

1. Provide a file for the AppWidget to define the basic configuration information of the widget

Create a new XML folder under the res directory of the resource folder and add an app_ widget_ provider_ The content of info.xml file is:

2. Create a widgetprovider that inherits from appwidgetprovider;

3. Create a layout file for the widgetprovider

Layout is a common layout

4. Register manifest.xml

The configuration is basically the same as broadcasting. The receiver node is used. The name of the meta data node is in a fixed format, the resource is the configuration information defined in the first step, and the third action of the intent filter node must be provided

5. Use pendingintent and remoteviews to bind the listener to the AppWidget, and use remoteviews to bind the listener to the bottom in the onupdate() method of myappwidgetprovider

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>