@@ -97,34 +97,37 @@ protected void onCreate(Bundle savedInstanceState)
97
97
if (pref == null )
98
98
continue ;
99
99
100
- if (isNew )
101
- {
102
- String def = jsonDefaults .get (p );
103
- if (pref instanceof StringMapPreference )
104
- ((StringMapPreference )pref ).setText ("" );
105
- else if (pref instanceof EditTextPreference )
106
- ((EditTextPreference )pref ).setText (def == null ? "" : def );
107
- else if (pref instanceof CheckBoxPreference )
108
- ((CheckBoxPreference )pref ).setChecked (false );
109
- }
110
- else
100
+ String def = jsonDefaults .get (p );
101
+ if (pref instanceof StringMapPreference )
102
+ ((StringMapPreference )pref ).setText ("" );
103
+ else if (pref instanceof EditTextPreference )
104
+ ((EditTextPreference )pref ).setText (def == null ? "" : def );
105
+ else if (pref instanceof CheckBoxPreference )
106
+ ((CheckBoxPreference )pref ).setChecked (false );
107
+ }
108
+
109
+ for (String p : jsonPrefs )
110
+ {
111
+ pref = findPreference (p );
112
+ if (pref == null )
113
+ continue ;
114
+
115
+ try
111
116
{
112
- try
113
- {
114
- if (entry .json .has (p ))
115
- {
116
- if (pref instanceof StringMapPreference )
117
- ((StringMapPreference )pref ).setObj (entry .json .getJSONObject (p ));
118
- else if (pref instanceof EditTextPreference )
119
- ((EditTextPreference )pref ).setText (entry .json .getString (p ));
120
- else if (pref instanceof CheckBoxPreference )
121
- ((CheckBoxPreference )pref ).setChecked (entry .json .getBoolean (p ));
122
- }
123
- }
124
- catch (JSONException e )
117
+ if (entry .json .has (p ))
125
118
{
119
+ if (pref instanceof StringMapPreference )
120
+ ((StringMapPreference )pref ).setObj (entry .json .getJSONObject (p ));
121
+ else if (pref instanceof EditTextPreference )
122
+ ((EditTextPreference )pref ).setText (entry .json .getString (p ));
123
+ else if (pref instanceof CheckBoxPreference )
124
+ ((CheckBoxPreference )pref ).setChecked (entry .json .getBoolean (p ));
126
125
}
127
126
}
127
+ catch (JSONException e )
128
+ {
129
+ }
130
+
128
131
if (pref instanceof EditTextPreference )
129
132
pref .setSummary (((EditTextPreference )pref ).getText ());
130
133
pref .setOnPreferenceChangeListener (this );
0 commit comments