I have created an array of SeekBars as following:
private SeekBar sliders[] = new SeekBar[1020];
I am interested in creating an onSeekBarChangeListener
that will loop through the sliders array.
Something like this may help you:
void registerSeekBarsListeners(sliders: Array<SeekBar>) {
for (SeekBar slider: sliders) {
slider.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
// PUT YOUR EVENT LISTENER CODE HERE
}
}
}
simply call registerSeekBarsListeners
with your sliders array and you are ready to go (or at least debug)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.