- if (existing) {
- AltosPreferencesBackend node = backend.node(common_frequencies_node_name);
- int count = node.getInt(frequency_count, 0);
-
- frequencies = new AltosFrequency[count];
- for (int i = 0; i < count; i++) {
- double frequency;
- String description;
-
- frequency = node.getDouble(String.format(frequency_format, i), 0.0);
- description = node.getString(String.format(description_format, i), null);
- frequencies[i] = new AltosFrequency(frequency, description);
+ try {
+ AltosJson json = AltosJson.fromString(backend.getString(frequenciesPreference,
+ null));
+ frequencies = (AltosFrequency[]) json.make((new AltosFrequency[1]).getClass());
+ } catch (Exception e) {
+ }
+
+ if (frequencies == null) {
+ if (backend.nodeExists(common_frequencies_node_name)) {
+ AltosPreferencesBackend node = backend.node(common_frequencies_node_name);
+ int count = node.getInt(frequency_count, 0);
+
+ if (count > 0) {
+ frequencies = new AltosFrequency[count];
+ for (int i = 0; i < count; i++) {
+ double frequency;
+ String description;
+
+ frequency = node.getDouble(String.format(frequency_format, i), 0.0);
+ description = node.getString(String.format(description_format, i), null);
+ frequencies[i] = new AltosFrequency(frequency, description);
+ }
+ }