*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
import java.text.*;
import android.content.Context;
-import org.altusmetrum.altoslib_10.*;
+import org.altusmetrum.altoslib_12.*;
public class AltosDroidPreferences extends AltosPreferences {
public static void set_active_device(DeviceAddress address) {
synchronized(backend) {
active_device_address = address;
- backend.putString(activeDeviceAddressPreference, active_device_address.address);
- backend.putString(activeDeviceNamePreference, active_device_address.name);
+ if (active_device_address != null) {
+ backend.putString(activeDeviceAddressPreference, active_device_address.address);
+ backend.putString(activeDeviceNamePreference, active_device_address.name);
+ } else {
+ backend.remove(activeDeviceAddressPreference);
+ backend.remove(activeDeviceNamePreference);
+ }
flush_preferences();
}
}