check network state in fragment in android
I defined two layers in a fragment, the display of which depends on the internet and gps on and off
There is no problem when the program runs, but when I enter another fragment and return to the first fragment, the code does not work properly.
onViewCreated
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
//broadcast receiver for check runtime network
val registerReceiver = requireActivity().registerReceiver(...