[Galaxy Note II, Galaxy S III Developer Discussion ] mithun46:
Integrating application in settings menu

This really handy one.. so take care!!:confused:

In this tutorial, we will add USB-Mode program to Settings menu as an example

On your PC

1)	Decompile SecSettings.apk.

2)	Decompile the program that you want to add to settings menu (USB-Mode)

3)	Go to \res\drawable-xhdpi folder and add icon for your program that you want to add (you can take it from decompiled wanted program (USBMode folder).

4)	Go to \res\values folder and open strings.xml by NotePad++ and add these lines just before </resources> for your program

<string name="gloryromaddons">GloryROM Addons</string>
<string name="usbswitcher_text">USB mode switcher</string>

Here change “gloryromaddons” with any thing you want to show as a header in the Settings menu. “usbswitcher_text” is your wanted program

5)	Go to \res\xml folder and open settings_headers.xml by NotePad++ and add these lines (the place you put these lines will be the place where added program will be displayed in Settings menu)

<header android:title="@string/gloryromaddons" />
<header android:icon="@drawable/usbswitcher" android:title="@string/usbswitcher_text">
<intent android:targetPackage="in.zatta.USB_switch" android:action="android.intent.action.MAIN" android:targetClass="in.zatta.USB_switch.USB_switcherActivity" />
</header>

The first line

reflect the header title in settings menu (So gloryromaddons will be seen as “GloryROM Addons” in the phone, see strings.xml that we edited and you will figure it out!!)

The 2nd line is for added program:

android:icon=@drawable/name of icon you put in drawable-xhdpi folder (here we put usbswitcher as the icon name inside drawable-xhdpi)

android:title=@string/name of string put for added program in strings.xml (here we put usbswitcher_text as in strings.xml)

The 3rd line

is the functionality and is the most difficult one:

android:targetPackage=package of wanted program inside its own AndroidManifest.xml (here it is “in.zatta.USB_switch”)

android:action=first action of wanted program inside its own AndroidManifest.xml (here it is “android.intent.action.MAIN”)

androidtargetClass= android:targetPackage.Activity (we have android:targetPackage from previous step but we need also .Activity how to get it??) This is the tricky one so do the following:

On your phone:

install the program you want to add (USB mode switcher) and ADW launcher from Google play and make ADW launcher as your phone launcher. Find a blank area on your homescreen(s), long press, then select custom shortcut --> pick your activity --> activities --> browse down until you find USB switcher app and expand with the arrow on the left of USB switcher, you will see several activities (some may have only one). The first one in the list is usually its opening class; it is in between the ( )'s. In this example it is .USB_switcherActivity

Go back to your PC:

So now androidtargetClass= android:targetPackage.Activity

will be:

androidtargetClass= in.zatta.USB_switch.USB_switcherActivity

6)	Now compile SecSettings and push it to your phone.

Additional step:

If you want to hide this app from applications drawer do the followings:

1)	Decompile your desired app (here USB-Mode.apk)

2)	Go to AndroidManifest.xml file and open it by NotePad++

3)	Delete this line :

<category android:name="android.intent.category.LAUNCHER" />

4)	Compile your app as non system apk and sign it then push it to your phone

Results example: