+ 1

How can I achieve that the TextView shows the current progress of the SeekBar without putting it in the SeekBar method?

... public SeekBar sb; public TextView tv; int sbvalue; ... tv = (TextView) findViewById (R.id.textView); sb = ... ... sb.setOnSeekBarChangeListener (new SeekBar.OnSeekBarChangeListener () { @Override public void onProgressChanged (seekBar, int progress, boolean fromUser) { sbvalue = sb.getProgress (); } @Override public void onStartTrackingTouch(...){...} ... } tv. setText(Integer.toString (sbvalue)); ... //the TextView just shows 0 //"..." means that I left out parts of the code

3rd Sep 2017, 8:40 PM
King Buakaw
King Buakaw - avatar
2 Antworten
+ 3
Is there a reason you don't want to update it in the seekbar listener?
3rd Sep 2017, 9:09 PM
ChaoticDawg
ChaoticDawg - avatar
0
Yes because in my app I have 3 SeekBars and I want to calculate things with the progress of those three, not just show the progress in a TextView. So if I would do that in the SeekBar listener of one of the SeekBars I think I just would have the current progress of this SeekBar and in addition and couldn't return any value from my calculation.
4th Sep 2017, 10:06 AM
King Buakaw
King Buakaw - avatar