Seekbar: two instances of OnSeekBarChangeListener issues
- by fordays
Hi,
I'm using two SeekBar widgets and I am encountering some trouble having them coexist at the same time. Can anyone suggest how to modify my code to work on the same Activity?
SeekBar ageSeek = (SeekBar)findViewById(R.id.ageSeek);
ageSeek.setOnSeekBarChangeListener(new OnSeekBarChangeListener()
{
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser)
{
if(fromUser)
{
age = progress;
EditAge.setText(Integer.toString(age));
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar)
{
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar)
{
}
});
SeekBar serumSeek = (SeekBar)findViewById(R.id.serumSeek);
serumSeek.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser)
{
if(fromUser)
{
serum = progress;
EditSerum.setText(Double.toString(serum));
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar)
{
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar)
{
}
});
}