Kotlin how to data transfer with navigation

20 views Asked by At

I have 3 fragment one is SettingsFragment and it has three seekingbar ı want to get value from seeking bar and turn back startfragment , ı have three value in three seekbar.

I tried this but when i take my hand out of seekbar it goes automatically go startFragment my code is here

binding.seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
            override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
               value = ((p1 + 1) * step).toLong()
               value = value * 1000
               binding.settingsTimeText.text = "Time : ${value}"

            }

            override fun onStartTrackingTouch(p0: SeekBar?) {
            }

            override fun onStopTrackingTouch(p0: SeekBar?) {
            val action = SettingFragmentDirections.actionSettingFragmentToStartFragment2(value)
                findNavController().navigate(action)
            }

        })

and this is startFragment code:

var time : Long = 30000
        time = arguments?.getLong("defaultTime") ?: 30000

How can ı store value without back StartFragment

0

There are 0 answers