From 15c63f508adbc7c48426437e5fa6e41f4ffc6b1f Mon Sep 17 00:00:00 2001 From: Asura146 Date: Sat, 10 Aug 2024 22:55:17 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=B8=AD=E3=80=81=E3=83=90?= =?UTF-8?q?=E3=82=B0=E3=81=82=E3=82=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/example/childguard/HomeFragment.java | 9 ++++++--- app/src/main/res/layout/fragment_home.xml | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/example/childguard/HomeFragment.java b/app/src/main/java/com/example/childguard/HomeFragment.java index daac6de..7ae943f 100644 --- a/app/src/main/java/com/example/childguard/HomeFragment.java +++ b/app/src/main/java/com/example/childguard/HomeFragment.java @@ -83,6 +83,7 @@ public class HomeFragment extends Fragment implements OnEventListener { super.onResume(); Log.d("HomeFragment", "onResume: called"); this.updateUiState(getIsInCarLocal()); + Log.d("isIncar", "onResume: " + getIsInCarLocal()); this.updateBluetoothSituation(isBluetoothConnected()); } @@ -93,7 +94,9 @@ public class HomeFragment extends Fragment implements OnEventListener { private boolean getIsInCarLocal() { SharedPreferences pref = requireActivity().getSharedPreferences("app_situation", requireActivity().MODE_PRIVATE); - return pref.getBoolean("isInCar", false); + Boolean isInCar = pref.getBoolean("isInCarPref", false); + Log.d("isInCarPref","isInCar"+ isInCar); + return pref.getBoolean("isInCarPref", false); } //画面遷移メソッド @@ -119,8 +122,8 @@ public class HomeFragment extends Fragment implements OnEventListener { TextView tv; FrameLayout fl; try { - tv = requireView().findViewById(R.id.situation); - fl = requireView().findViewById(R.id.situation_bg); + tv = requireView().findViewById(R.id.car_situation); + fl = requireView().findViewById(R.id.car_situation_bg); } catch (NullPointerException e) { Log.d("HomeFragment", "updateUiState: view is null"); return false; diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 07e986f..0c31fc6 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -19,7 +19,7 @@ app:layout_constraintTop_toTopOf="parent">