[Galaxy Note GT-N7000 Themes and Apps] nobnut:
Basic Tutorial

It sounds like you are on the right track already. You don't want to 'extract' the apk however.

All you need is APK Multi-tool and 7zip. To edit 'code', or to be more precise, to edit .xml files which you can find inside apks, you can use Notepad++. Different people use different tools, but to get started, this is all you need.

The following sounds complicated if you are not familiar with it. But believe me, it isn't... just read it over a couple of times and have a play around. Always make sure you have an original file backed up somewhere and you can do no harm. If things get really bad, just restore your backup or reflash your ROM if things get really funky.

To swap images

1. Using 7zip, OPEN (do not extract at this point) the apk file by right clicking on it and selecting 'open archive' from the 7zip context menu. You can now browse through the apk contents like a normal file explorer. You can drag files (images) out of and back in to the relevant folder as you can in a normal file explorer.

In this way you can swap images (making sure that the size and name are both correct).

You can use 7zip to navigate around a ROM in zip form and to find the apk you want to view/edit.

2. Basically find the image you want. It will need to be a .png file (which supports transparency) and the same size as the original file. Some images are resized when they are loaded on the phone, others do not. Either way, it will need to have the same dimensions as the original image (e.g. 72px x 72px).

There is one important thing you must bear in mind. You will see some images that have the extension .9.png instead of just .png. These are called Draw 9-patch files. You can read more about them here, but basically they have a transparent 1 pixel border around the edge and are used in various specific places in the apk. There are different free .9.png editors around, do a Google.

I would suggest that you start off by just editing normal .png files until you get the hang of it, then when you know what you are doing, you can add the .9.png files into the mix :)

3. Once you have finished, all you need to do is to exit 7zip and if you have replaced any files, you will receive a prompt from 7zip to ask if you are sure you want to update the apk file. Accept it.

4. You can then use this apk in your ROM... BUT the images you have swapped might not be optimised and the apk might not be zipaligned anymore. This is where APK Multi-tool is used.

Optimise and Zipalign Your APK

1. Read the instructions for APK Multi-tool for the full story, but basically you can take the apk you have changed, place it in the correct folder in APK Multi-tool and then using the menu items you want to:

- 1. Extract the apk

- 2. Optimise the images inside

- 3. Zip the apk (including signing using the original signatures if it is a system file)

- 5. Zipalign the apk

(You will note that we skipped 4 above as you do not want to resign the apk if it is a system file)

Now you can use the apk file on your phone by ADB pushing it, copying it in a root explorer, setting permissions correctly and rebooting, or using a flashable zip.

Finally code editing

XML files inside an apk control lots of things such as language, positioning, size of things etc You cannot edit (or even view the contents of) an xml file which is not decompiled. Its contents look like a load of junk if you open one.

1. If you want to edit xml files inside an apk, you must first decompile it using APK Multi-tool or similar.

2. You can then use Notepad++ to edit the xml file.

3. You can then compile the apk again. If you get errors compiling... view the log and then it is time to use Google ;)

4. Once you have compiled correctly, you can use this apk by pushing etc.

Good luck!!

EDIT:

A quick note about zipaligning.

You will see lots of Chefs saying things like "all apks zipaligned at every boot"... and being very proud about it. *facepalm*

If an apk is zipaligned, it is zipaligned. If you have a file in your init.d folder and a corresponding zipalign file in your xbin folder, then yes, every time your phone boots up, it zipaligns all of the damned apks in your system and data partitions... again... and again... and again.

One question Chefs? Why??

All this does is slow down our boot time and adds nothing of value at all, as the apks are already bloody aligned!

I recommend that once you have run this the first time, move the relevant file out of the etc/init.d folder on to your SD card. You will see your next boot be a little faster ;)

Perhaps move the file back in to the init.d folder once per month or so and reboot just to make sure any new apks are ziplaligned and then move it out again.

You can view the content of these init.d scripts using Notepad++ mentioned above.

EDIT 2: It is always worth having a look at the contents of all of the scripts in your init.d folder. You will some across some shocking errors and also a good number of useless scripts.

A classic example is when the 'Chef' has lifted a bunch of scripts from various threads across XDA or the internet on the assumption that 'more is better'. I once downloaded a custom ROM (for another device) and there were four scripts among 16 which set the SD card readahead value (this can decrease the time it takes to load gallery images etc). The first set it to 1024, then it was set to 2048, the third set it to 1024 again and the final one set it to... 128.

Great! This value was changed four times and the final value set was the same as the ROM's default value!!

That 'Chef' was (and probably still is) useless but it didn't stop him from begging for donations... and it didn't stop naive people from giving him donations. It makes me mad :mad:

Another example is when the Chef has included a script to zipalign but hasn't included the requisite zipalign file in xbin. The script therefore cannot run.

Moral of the story? Read and learn... then do it for yourself :) All too many custom builds, contrary to the Chef's claims, are not optimised and faster, but buggy and slower. That is why I don't use (and don't even like flashing) 'custom ROMs'.

Beware of other claims also, test things for yourself, don't just take someone's word for an improvement. The Bravia Engine 'fix' is an example. Does it really improve image and video quality?

No.