Detailed explanation of Android control appwidgetprovider usage

introduce

@R_ 404_ 291 @ is a class provided in Android to implement desktop gadgets. Its essence is a broadcast, that is, broadcastreceiver. In actual use, use @ R_ 404_ 291 @ just act 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 inherited from @ r_ 404_ 291@;

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 listeners to AppWidget, and use remoteviews to My@R_ 404_ 291 @ bind listener for bottom in onupdate() method

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
分享
二维码
< <上一篇
下一篇>>