XML Edits How to [ Updated \ 07/24/09 ]

I will be adding information to help people complete XML hacks here, however, This is not a simple thing to do!
This is not something you just fall into. Sure, I can tell you what to change for certain effects but you wont learn anything. So other then taking what somebody has done and using it yourself I will not give direct directions on how to create certain effects.

I will help you learn but I will not do it for you.

The first thing to go over is what you will need.

You can find the entire source here: http://www.netmite.com/android/mydroid/
I use it as a reference all the time when I'm on windows.

I have uploaded a file called resourcetypes/h that contains alot of information in it about how things are translated to binary, in fact everything I will document below was retrieved from that file.

Keep in mind that Android looks at things in bits when compiling this code into hex. And since in hex all we deal with are bytes we need to do some quick math.

In every byte (00) there are 8 bits When you see something in the code like this: uint16_t size; That is android talking about 16 bits which in hex is 2 bytes because every byte is equal to 8 bits.

Got it? Good...
Lets take a look at some code!

Code:
```   // Number of bytes in this structure.
uint16_t size;```
This means the first two bytes reference how many bytes are in this structure. Specifically speaking, for the most part everything we will deal with here is five bytes long. So the first values in hex would be 05 00 if there were five bytes in this structure...

Code:
```    // Always set to 0.
uint8_t res0;```
This means the next byte will always be zero, since its 8 bits its only one byte. Which would look like this in hex 00 So combined with what we have above we should see 05 00 00

Code:
```
// Type of the data value.
enum {```
enum in this case means that the next byte will be one of the following values depending on what it is we are translating to binary.

Code:
```        // Contains no data.
TYPE_NULL = 0x00,```

Means this byte should be 00 and the byte after it holds no data... So the structure would be 05 00 00 00 ... so far....

Code:
```        // The 'data' holds a ResTable_ref, a reference to another resource
// table entry.
TYPE_REFERENCE = 0x01,```
Means the byte(s) after this byte 01 holds a pointer to a resource, which could be an image or any other type of resource stored with Resources.arsc. So combined with what we have above we should see 05 00 00 01

Code:
```        // The 'data' holds an attribute resource identifier.
TYPE_ATTRIBUTE = 0x02,```
Means the byte(s) after this byte 02 points to an attribute in the resources.arsc. So combined with what we have above we should see 05 00 00 02

Code:
```        // The 'data' holds an index into the containing resource table's
// global value string pool.
TYPE_STRING = 0x03,```
Means the byte(s) after this byte 03 points to a string in the string table of resources.arsc. So combined with what we have above we should see 05 00 00 03

Code:
```        // The 'data' holds a single-precision floating point number.
TYPE_FLOAT = 0x04,```
Means the byte(s) after this byte 04 Holds a floating point number...
So combined with what we have above we should see 05 00 00 04

Code:
```        // The 'data' holds a complex number encoding a dimension value,
// such as "100in".
TYPE_DIMENSION = 0x05,```
Means the byte(s) after this byte 05 holds the value of dimension...a lot of times this can be a vlaue for a height or a width of an object, such as an image. So combined with what we have above we should see 05 00 00 05

Code:
```        // The 'data' holds a complex number encoding a fraction of a
// container.
TYPE_FRACTION = 0x06,```
Means the byte(s) after this byte 06 holds a complex number encoding a fraction of a container. So combined with what we have above we should see 05 00 00 06

Code:
```        // Beginning of integer flavors...
TYPE_FIRST_INT = 0x10,

// The 'data' is a raw integer value of the form n..n.
TYPE_INT_DEC = 0x10,
// The 'data' is a raw integer value of the form 0xn..n.
TYPE_INT_HEX = 0x11,
// The 'data' is either 0 or 1, for input "false" or "true" respectively.
TYPE_INT_BOOLEAN = 0x12,```
Same rules apply here...I dont think I have to keep explaining them all....

Code:
```        // Beginning of color integer flavors...
TYPE_FIRST_COLOR_INT = 0x1c,

// The 'data' is a raw integer value of the form #aarrggbb.
TYPE_INT_COLOR_ARGB8 = 0x1c,
// The 'data' is a raw integer value of the form #rrggbb.
TYPE_INT_COLOR_RGB8 = 0x1d,
// The 'data' is a raw integer value of the form #argb.
TYPE_INT_COLOR_ARGB4 = 0x1e,
// The 'data' is a raw integer value of the form #rgb.
TYPE_INT_COLOR_RGB4 = 0x1f,

// ...end of integer flavors.
TYPE_LAST_COLOR_INT = 0x1f,

// ...end of integer flavors.
TYPE_LAST_INT = 0x1f
};```
Means the byte(s) after this byte holds a color value. If the 4th byte is 1C Then the bytes afterwards will define a color value that is in the format #FFFFFFFF transparency, red, green, blue.

If the byte is 1E Then the bytes following will represent a color value in the format #FFF Red, green, blue.

HOWEVER, one thing important to know here is that regardless of the format of the color value whether it be RGB or AARRGGBB Android will convert it to hex and it will appear as FF FF FF FF

Code:
`    uint8_t dataType;`
This is where the FIFTH byte gets added, whatever it may be...it will be one of the values listed above.

I will add more stuff later. The file posted below has everything I've added and more....If you want to know more...open that files up and read it...study it...

Stericson
Attached Files
 ResourceTypes.zip - [Click for QR Code] (14.2 KB, 3482 views)