<Why my variable "inaltime" is not retaining any v...
# stackoverflow
u
Why my variable "inaltime" is not retaining any value from the previous fragment In SharedViewModelClass: class SharedViewModel : ViewModel() { private var _inaltime= MutableLiveData(0.0) val inaltime : LiveData = _inaltime } In the first fragment: class StartFragment : Fragment() { private var binding: FragmentStartBinding? =null private val sharedViewModel: SharedViewModel by activityViewModels() override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { val fragmentBinding =...