HomeFragmentがResumeされたときにローカルの最新を読み込むように
This commit is contained in:
parent
e84b21288f
commit
9d431bd297
|
@ -1,5 +1,6 @@
|
||||||
package com.example.childguard;
|
package com.example.childguard;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -76,6 +77,12 @@ public class HomeFragment extends Fragment implements OnEventListener{
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
Log.d("HomeFragment", "onResume: called");
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
//画面遷移メソッド
|
//画面遷移メソッド
|
||||||
|
|
Loading…
Reference in New Issue
Block a user