[Android Q&A, Help & Troubleshooting] projectmax:
good day, I need some help in adding some codes to settings.smali. I want to add a condition to the preferencetreeclick method but I always get a force close error, the condition I'm trying to add would be that if wifi toggle is checked then call wifi_settings subscreen. please help me on this one devs. thanks..

.method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z
.locals 4
.parameter "preferenceScreen"
.parameter "preference"

.prologue
const-string v3, "com.android.settings"

.line 175
invoke-virtual {p2}, Landroid/preference/Preference;->getKey()Ljava/lang/String;

move-result-object v1

.line 176
.local v1, key:Ljava/lang/String;
const-string v2, "call_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_1

.line 177
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 178
.local v0, intent:Landroid/content/Intent;
const-string v2, "com.android.phone"

const-string v3, "com.android.phone.CallSettings"

invoke-virtual {v0, v2, v3}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 179
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

.line 258
.end local v0 #intent:Landroid/content/Intent;
:cond_0
:goto_0
invoke-super {p0, p1, p2}, Landroid/preference/PreferenceActivity;->onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z

move-result v2

return v2

.line 180
:cond_1
const-string v2, "fm_transmitter_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_2

.line 181
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 182
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.mediatek.FMTransmitter"

const-string v3, "com.mediatek.FMTransmitter.FMTransmitterActivity"

invoke-virtual {v0, v2, v3}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 184
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto :goto_0

.line 185
.end local v0 #intent:Landroid/content/Intent;
:cond_2
const-string v2, "customization_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_3

.line 186
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 187
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.Customization"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 188
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto :goto_0

.line 189
.end local v0 #intent:Landroid/content/Intent;
:cond_3
const-string v2, "gemini_sim_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_4

.line 190
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 191
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.gemini.SimManagement"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 192
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto :goto_0

.line 193
.end local v0 #intent:Landroid/content/Intent;
:cond_4
const-string v2, "toggle_wifi"
# i don't know if this is the right dalvik code for the condition I want to add..
iget-boolean v2, v3, Lcom/android/settings/Settings;->mWifiEnabler:Lcom/android/settings/wifi/WifiEnabler;

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_5

.line 194
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 195
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.wifi.WifiSettings"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 196
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto :goto_0

.line 197
.end local v0 #intent:Landroid/content/Intent;
:cond_5
const-string v2, "audio_profile_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_6

.line 198
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 199
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.audioprofile.AudioProfileSettings"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 201
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto :goto_0

.line 202
.end local v0 #intent:Landroid/content/Intent;
:cond_6
const-string v2, "display_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_7

.line 203
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 204
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.DisplaySettings"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 205
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto/16 :goto_0

.line 206
.end local v0 #intent:Landroid/content/Intent;
:cond_7
const-string v2, "location_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_8

.line 207
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 208
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.LocationSettings"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 209
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto/16 :goto_0

.line 210
.end local v0 #intent:Landroid/content/Intent;
:cond_8
const-string v2, "security_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_9

.line 211
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 212
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.SecuritySettings"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 213
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto/16 :goto_0

.line 214
.end local v0 #intent:Landroid/content/Intent;
:cond_9
const-string v2, "applications_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_a

.line 215
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 216
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.ApplicationSettings"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 217
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto/16 :goto_0

.line 218
.end local v0 #intent:Landroid/content/Intent;
:cond_a
const-string v2, "privacy_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_b

.line 219
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 220
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.PrivacySettings"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 221
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto/16 :goto_0

.line 222
.end local v0 #intent:Landroid/content/Intent;
:cond_b
const-string v2, "storage_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_c

.line 223
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 224
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.deviceinfo.Memory"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 225
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto/16 :goto_0

.line 226
.end local v0 #intent:Landroid/content/Intent;
:cond_c
const-string v2, "language_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_d

.line 227
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 228
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.LanguageSettings"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 229
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto/16 :goto_0

.line 230
.end local v0 #intent:Landroid/content/Intent;
:cond_d
const-string v2, "accessibility_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_e

.line 231
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 232
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.AccessibilitySettings"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 234
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto/16 :goto_0

.line 235
.end local v0 #intent:Landroid/content/Intent;
:cond_e
const-string v2, "date_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_f

.line 236
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 237
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.DateTimeSettings"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 238
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto/16 :goto_0

.line 239
.end local v0 #intent:Landroid/content/Intent;
:cond_f
const-string v2, "power_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_10

.line 240
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 241
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.schpwronoff.AlarmClock"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 243
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto/16 :goto_0

.line 244
.end local v0 #intent:Landroid/content/Intent;
:cond_10
const-string v2, "about_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_11

.line 245
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 246
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.DeviceInfoSettings"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 247
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto/16 :goto_0

.line 248
.end local v0 #intent:Landroid/content/Intent;
:cond_11
const-string v2, "voice_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_12

.line 249
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 250
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.VoiceInputOutputSettings"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 252
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto/16 :goto_0

.line 253
.end local v0 #intent:Landroid/content/Intent;
:cond_12
const-string v2, "dock_settings"

invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_0

.line 254
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 255
.restart local v0 #intent:Landroid/content/Intent;
const-string v2, "com.android.settings"

const-string v2, "com.android.settings.DockSettings"

invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

.line 256
invoke-virtual {p2, v0}, Landroid/preference/Preference;->setIntent(Landroid/content/Intent;)V

goto/16 :goto_0
.end method