1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 13:26:50 +01:00

Fix crash when acquiring location

This commit is contained in:
José Rebelo 2023-07-26 23:38:55 +01:00 committed by José Rebelo
parent e9af9d9b4a
commit e068bfdb75

View File

@ -543,12 +543,11 @@ public class SettingsActivity extends AbstractSettingsActivityV2 {
String longitude = String.format(Locale.US, "%.6g", location.getLongitude()); String longitude = String.format(Locale.US, "%.6g", location.getLongitude());
LOG.info("got location. Lat: " + latitude + " Lng: " + longitude); LOG.info("got location. Lat: " + latitude + " Lng: " + longitude);
GB.toast(requireContext(), getString(R.string.toast_aqurired_networklocation), 2000, 0); GB.toast(requireContext(), getString(R.string.toast_aqurired_networklocation), 2000, 0);
EditTextPreference pref_latitude = findPreference("location_latitude"); GBApplication.getPrefs().getPreferences()
EditTextPreference pref_longitude = findPreference("location_longitude"); .edit()
pref_latitude.setText(latitude); .putString("location_latitude", latitude)
pref_longitude.setText(longitude); .putString("location_longitude", longitude)
pref_latitude.setSummary(latitude); .apply();
pref_longitude.setSummary(longitude);
} }
} }
} }