1.<meta-data> provides a name value pair for the build
<meta-data android:name= "string"
Android:resource= "Resource Specification" android:value= "string"/>
can be defined in <activity><activity-alias> <service><receiver > in
A component can contain any number of <meta-data>.
When parsing to the <meta-data> node, put the Bundle object and assign it to packageiteminfo.metadata
Activityinfo info = Getpackagemanager (). Getactivityinfo (new componentname (This, Myexcesizeactivity. class == bundle.getstring ("Com.rytong");
<meta-data android:name= "Com.rytong" android:resource= "@string/liyuejiao" ></meta-data>
only get the ID of the @string/liyuejiao as com.rytong the value
2 defining Widgets (extends Appwidgetprovider)
When the Widget is added, deleted, according to <receive 's <action android:name= "xx", thesystem issues a broadcast ,
Its own definition of the broadcast recipient Mywidget (extends Appwidgetprovider) receives the broadcast, calls onenabled (), OnUpdate (), ondeleted (), Ondisabled ().
<receiver android:name= "Exampleappwidgetprovider" > <intent-filter> <action android:name= " Android.appwidget.action.APPWIDGET_UPDATE "/> <action android:name=" android.appwidget.action.APPWIDGET_ DELETED "/> </intent-filter> <meta-data android:name=" Android.appwidget.provider " android:resource< /c1>= "@xml/example_appwidget_info"/></receiver>
3 get the Widget's configuration file by <meta-data> android.appwidget.provider This fixed name ( Specify individual properties )
Res/xml/appwidget_info.xml
<appwidget-provider xmlns:android= "http://schemas.android.com/apk/res/android" android:minwidth= " 294DP " android:minheight=" 72DP " android:updateperiodmillis=" 86400000 " android:previewimage = "@drawable/preview" android:initiallayout= "@layout/example_appwidget" android:configure= "Com.example.android.ExampleAppWidgetConfigure" android:resizemode= "Horizontal|vertical" ></ Appwidget-provider>
**
Android:updateperiodmillis periodically sends broadcasts called "Android.appwidget.action.APPWIDGET_UPDATE" for broadcast recipients
android1.5 after 0, do not need to periodically send update broadcast
Android:initiallayout specifying the default display interface
4 Start a service, run in the background for a long time, keep updating widgets
Set as daemon: When the service thread exits, the daemon also exits
When there are multiple widgets on the desktop , each widget is deleted, calling ondeleted ()
When the last Widget is deleted, call ondeleted (), ondisabled ()
When there is no widget on the desktop, that is , when the last widget is deleted, the service is stopped in ondisabled () .
Android Widget Widgets