Quantcast
Channel: xda-developers - Android Themes
Viewing all articles
Browse latest Browse all 4090

[GUIDE] Create new activity with Alert dialog in Settings

$
0
0
Maybe this guide is too many right here, but i'm coming with a new innovasion with an alert dialog or pop up window. this guide for example like adding rom control on the settings. I am sure it should work for most devices running 2.3.x until 4.x.x

so, lets begin

Requirements:
1. Tools to compile-decompile

2. Notepad ++

3. Attach file

How to:
1. decompile your settings.apk

2. open res/xml/settings_headers.xml. now go to the end and add this code below (or whereever you want it to be)
Code:

<header android:icon="@drawable/ic_settings_advanced" android:id="@id/custom_settings" android:title="@string/rom_settings" android:fragment="com.android.settings.octo.MainActivity" />
3. open values/ids.xml and add this code
Code:

<item type="id" name="rom_settings">false</item>
4. make sure to add a icon named "ic_setting_advanced" in the drawable folder

5. then, open res/values/strings.xml, add this code
Code:

<string name="rom_settings">Rom control</string>
<string name="alert">Alert header title</string>
<string name="alert_summary">"alert header summary"</string>

6. next, you need to make new xml. example: named it to rom_settings.xml
inside rom_control.xml, paste this code
Code:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen android:title="@string/rom_settings"
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
    <PreferenceScreen android:title="@string/testing_phone_info">
        <intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.android.settings.RadioInfo" />
    </PreferenceScreen>
    <PreferenceScreen android:title="@string/testing_battery_info">
        <intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.android.settings.BatteryInfo" />
    </PreferenceScreen>
    <PreferenceScreen android:title="@string/testing_usage_stats">
        <intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.android.settings.UsageStats" />
    </PreferenceScreen>
    <PreferenceScreen android:title="@string/testing_wifi_info">
        <intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.android.settings.wifi.WifiInfo" />
    </PreferenceScreen>
</PreferenceScreen>

7. save as and then save to res/xml/here

8. now, recompile the apk and then decompile it again

9. open res/values/public.xml. search:
Code:

<public type="string" name="alert" id="0x7fxxxxxx" />
<public type="string" name="alert_summary" id="0x7fxxxxxx" />
<public type="xml" name="rom_settings" id="0x7fxxxxxx" />

10. open com/android/settings/octo/MainActivity.smali

11. find this code 0x7f06005e and replace with your code from <public type="xml" name="rom_settings"

12. find this code 0x7f090be4 and replace with your code from <public type="string" name="alert"

13. find this code 0x7f090be5 and replace with your code from <public type="string" name="alert_summary"

14. save. recompile your settings then push/flash it

Screenshot on attach

Attached Thumbnails
Click image for larger version

Name:	Screenshot_-S-18-p-14_20.20.17.png
Views:	N/A
Size:	111.7 KB
ID:	2941675  
Attached Files
File Type: rar smali.rar - [Click for QR Code] (1.7 KB)

Viewing all articles
Browse latest Browse all 4090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>