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

This commit is contained in:
ろむねこ 2024-07-11 14:01:16 +09:00
parent dfc9440ab5
commit d817dfaf58
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -80,6 +80,12 @@ public class HomeFragment extends Fragment implements OnEventListener {
super.onResume(); super.onResume();
Log.d("HomeFragment", "onResume: called"); Log.d("HomeFragment", "onResume: called");
this.updateUiState(getIsInCarLocal()); 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() { private boolean getIsInCarLocal() {