onResumeでSharedPreferenceから読み取ってUIを更新するように

This commit is contained in:
r-ca committed 2024-07-11 14:01:16 +09:00
1 parent dfc9440ab5
commit d817dfaf58
1 file changed
+6
@@ -80,6 +80,12 @@ public class HomeFragment extends Fragment implements OnEventListener {
super.onResume();
Log.d("HomeFragment", "onResume: called");
this.updateUiState(getIsInCarLocal());
this.updateBluetoothSituation(isBluetoothConnected());
}
private boolean isBluetoothConnected() {
SharedPreferences pref = requireActivity().getSharedPreferences("Bluetooth_situation", requireActivity().MODE_PRIVATE);
return pref.getBoolean("status", false);
}
private boolean getIsInCarLocal() {