I tried this but getting error because the function myListener should return something.
what I want to do is to get the seek bar value each time I’m changing it’s value at runtime and assign the value to another variable name counter.
class MainActivity : AppCompatActivity() {
val seek = findViewById<SeekBar>(R.id.seekBar)
var flashLightStatus: Boolean = false
val counter = 0;
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
seek.setOnSeekBarChangeListener(myListener())
startFlashLight()
}
private fun myListener(): SeekBar.OnSeekBarChangeListener? {
}
2
Answers
You have to extend the function
onProgressChanged
you can use this code and listen value change runtime