From 9d431bd2977b00177d674e4ee9249234372a7676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 19 Jan 2024 12:53:01 +0900 Subject: [PATCH] =?UTF-8?q?HomeFragment=E3=81=8CResume=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=9F=E3=81=A8=E3=81=8D=E3=81=AB=E3=83=AD=E3=83=BC=E3=82=AB?= =?UTF-8?q?=E3=83=AB=E3=81=AE=E6=9C=80=E6=96=B0=E3=82=92=E8=AA=AD=E3=81=BF?= =?UTF-8?q?=E8=BE=BC=E3=82=80=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/example/childguard/HomeFragment.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/com/example/childguard/HomeFragment.java b/app/src/main/java/com/example/childguard/HomeFragment.java index 5e852ba..d3e093b 100644 --- a/app/src/main/java/com/example/childguard/HomeFragment.java +++ b/app/src/main/java/com/example/childguard/HomeFragment.java @@ -1,5 +1,6 @@ package com.example.childguard; +import android.content.SharedPreferences; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; @@ -76,6 +77,12 @@ public class HomeFragment extends Fragment implements OnEventListener{ public void onResume() { super.onResume(); Log.d("HomeFragment", "onResume: called"); + this.updateUiState(getIsInCarLocal()); + } + + private boolean getIsInCarLocal() { + SharedPreferences pref = requireActivity().getSharedPreferences("app_situation", requireActivity().MODE_PRIVATE); + return pref.getBoolean("isInCar", false); } //画面遷移メソッド