1

I have implemented the VerticalSeekBar using this unbelievably simple solution here: How can I get a working vertical SeekBar in Android?

The problem is, I can't seem to set an onseekbarchangelistener in my UI Activity that uses this class. I can't for the life of me understand how to do this. I can do it from within the VerticalSeekBar class: if I add code inside the onTouch() method, it works.

However I need an onTouch listener in my Activity.

P.S. is there a particular reason why Android doesn't have a native vertical seekbar? Considering most phones are naturally portrait-mode devices, it makes sense to have bars running along the the length rather than the width of the screen. I have tried many VerticalSeekBar solutions from stackoverflow (love this site!), but the only solution that centers my SeekThumb graphic is the link supplied above. I have been working on getting a perfect vertical seekbar for months now. Any help would be a humansend!

Community
  • 1
  • 1
TantrumV1
  • 31
  • 5

2 Answers2

1

in VerticalSeekBar class, comment out this whole part:

@Override
public void setOnSeekBarChangeListener(OnSeekBarChangeListener mListener) {
  this.myListener = mListener;
}
josephus
  • 8,284
  • 1
  • 37
  • 57
0

instead you can do this

SeekBar sb = (SeekBar)findViewById(R.your.id);
sb.setOnSeekBarChangeListener(this);

Eclipse would underline it and ask you to implement onseekbarchangelistener, you do that and implement the methods and you are good to go

Good Luck !

Mayank
  • 1,364
  • 1
  • 15
  • 29