Seekbar: two instances of OnSeekBarChangeListener issues

Posted by fordays on Stack Overflow See other posts from Stack Overflow or by fordays
Published on 2010-06-08T03:33:08Z Indexed on 2010/06/08 3:42 UTC
Read the original article Hit count: 678

Filed under:

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)
                    {

                    }
            });

}

© Stack Overflow or respective owner

Related posts about android