How do we sometimes want to add our own new resources to the standard framework?
The idea is for us to try.
Through Eclipse's connection, we can relate to whether it is simply putting strings in the various folders of Res. First to try, compile, the system immediately error. Why, then?
It prompts you to use make UPDATE-API this command to update the Public.xml file or to refer to this statement as the hide type. This is definitely not what we want.
So there are two ways:
Method 1:After the resource has been added normally, execute the Make Update-api function. The system updates the Res/values/public.xml file.
Method 2:After the resource has been added normally, manually change the/res/values/public.xml file. Open the Public.xml file. The discovery structure is as follows:
Copy Code code as follows:
<resources>
<!--We don ' t want to publish private symbols into ANDROID.R as part of the
Sdk. Instead, put the them here. -->
<private-symbols package= "Com.android.internal"/>
<!--androidmanifest.xml attributes. -->
<eat-comment/>
<!--===============================================================
Resources for version 1 of the platform.
===============================================================-->
<eat-comment/>
<public type= "string" name= "Cancel" id= "0x01040000"/>
<public type= "string" name= "copy" id= "0x01040001"/>
<public type= "string" name= "Copyurl" id= "0x01040002"/>
<public type= "Style" Name= "TextAppearance.Widget.TextView.SpinnerItem" id= "0x01030052"/>
<public type= "Style" Name= "Textappearance.windowtitle" id= "0x01030053"/>
<public type= "attr" name= "theme" id= "0x01010000"/>
<public type= "attr" name= "label" id= "0x01010001"/>
<public type= "attr" name= "icon" id= "0x01010002"/>
<public type= "attr" name= "name" id= "0x01010003"/>
<public type= "attr" name= "managespaceactivity" id= "0x01010004"/>
<public type= "attr" name= "Allowclearuserdata" id= "0x01010005"/>
<public type= "attr" name= "permission" id= "0x01010006"/>
<public type= "attr" name= "readpermission" id= "0x01010007"/>
<public type= "attr" name= "writepermission" id= "0x01010008"/>
<public type= "attr" name= "ProtectionLevel" id= "0x01010009"/>
<!--===============================================================
Added in version 7 of the platform (Eclair MR1).
===============================================================-->
<eat-comment/>
<public type= "attr" name= "author" id= "0x010102b4"/>
<public type= "attr" name= "AutoStart" id= "0x010102b5"/>
</resources>
In this way, we can add our own hands.
Recommended Method 1, is also the most standard approach. Why?
1: Avoid duplicate IDs.
2: Trouble
3: Customary standardization procedure.