[Galaxy Y GT-S5360 Android Development] blackbeard:
Many of the members asked me how did I call another app from settings in this post.

This is a tutorial showing how to do that. You can implement it in any other app as well.

Things required:

1. A settings.apk from any device. (Just for tutorial purpose, can be done on any other app)

2. An apk decompiling/compiling tool (I use apktool)

3. Some icons to make it look better

4. The apk of the app you wanna invoke

And we are ready to rock :victory:

STEP 1

:

Decompile settings.apk

[FONT="Courier New"]apktool if framework-res.apk
I: Framework installed to: C:\Users\xxxxxxxx\apktool\framework\1.apk

apktool d -f Settings.apk out
I: Baksmaling...
testI: Loading resource table..
I: Loaded.
I: Loading resource table from
I: Loaded.
I: Decoding file-resources...
I: Loading resource table from
I: Loaded.
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...[/FONT]

STEP 2

:

Open out/res/values/strings.xml

Go to the end of the file and add this code

[FONT="Courier New"]
<string name="example_settings">Example settings</string>[/SIZE]

​

You can give any name to the string, just remember it.

STEP 3

:

Open out/res/values/xml/settings.xml

Now here you see a lot of xml coding. Every line is for a setting option. Figure out where you want to place the new option. Here we will add option to the end of the code, i.e. the last option

Just above the line

</PreferenceScreen>

ADD THIS CODE

[FONT="Courier New"]
<com.android.settings.IconPreferenceScreen android:title="@string/[COLOR="Lime"]example_settings[/COLOR]" settings:icon="@drawable/[COLOR="SeaGreen"]icon_name[/COLOR]">
<intent android:targetPackage=[COLOR="Magenta"]"it.sineo.android.noFrillsCPU"[/COLOR] android:action="android.intent.action.MAIN" android:targetClass=[COLOR="DeepSkyBlue"]"it.sineo.android.noFrillsCPU.activity.MainActivity"[/COLOR] />
</com.android.settings.IconPreferenceScreen>[/SIZE]

[/FONT]

HERE'S THE TRICKY PART

Well the green part is the icon name. The icon can be placed in drawable-ldpi or mdpi or hdpi folders. Be sure to paste the same icon name to the green part, excluding the file format(.png).

In the above code, the line

[COLOR="Lime"]example_settings

[/COLOR] here, "example_settings" is replaced by the name you gave in res/values/strings.xml. (Step2)

Where did we get the values in pink and sky blue :confused: :confused: :confused:

STEP 4

:

Decompile third party app

Here, we will use No-Frills CPU for heaven's sake

[FONT="Courier New"]apktool d -f nofrills.apk cpu[/SIZE]

[/FONT]

Don't worry if errors, we just want AnrdoidManifest.xml

STEP 5

:

Open the AndroidManifest.xml of third party app

Find the code

[FONT="Courier New"][COLOR="RED"] package= [/COLOR][/SIZE]

[/FONT]

Mostly on the first line.

After =, whatever is in quotes is your package name. This is what is your pink text in settings.xml (step3).

Copy and paste it as it is

Again in AndroidManifest.xml, find the main activity name. Mostly developers name main activity as Main or MainActivity. You will find it as

".activity.MainActivity"

in this case.

Copy it and in settings.xml, the text in sky blue is the main activity name. It should be written as

[Color="Magenta"]package name[/color] MainActivity name

So we get

it.sineo.android.noFrillsCPU.activity.MainActivity

This is your sky blue text in settings.xml (step3)

Copy and paste it as it is

STEP 6

:

Compile Settings.apk

apktool b out
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...

STEP 7

:

Pre-Final step

Perform the following steps

Open the folder "out" or the one you compiled in

Go to build/apk/

Copy "[color="red"]res[/color]" and "[color="red"]resources.arsc[/color]"

Open stock Settings.apk with 7zip

Paste res folder and resources.arsc here. (overwrite)

STEP 8

:

Push settings.apk

Copy modified settings.apk on sdcard

Connect mobile and enable usb debug. Don't connect in usb storage mode

Using adb, insert the code

[Size="2"]
adb shell

su

stop

mount -o rw,remount /system/ /system/

busybox cp /sdcard/Settings.apk /system/app/

mount -o ro,remount /system/ /system/

reboot

Thats it. If you have any problems, post here.

hit thanks if i helped

​

[/FONT]