Search code examples
javaandroidseekbar

Method onStartTrackingTouch and getProgress() of seekbar. First value is always 0.


For a lock/unlock system I use the onStartTrackingTouch and onStopTrackingTouch methods. And testing, I don't understand one thing:

public void onStartTrackingTouch(SeekBar seekBar) {

Log.d(TAG,"Progress: "+seekBar.getProgress());

    }

The first value is always zero.

Why? I need the real value!

Can anybody help me?

Thanks in advance.


Solution

  • I've changed my idea, finally i've used onProgressChanged:

    public void onProgressChanged(SeekBar seekBar, int progress,
            boolean fromUser) {
        if(progress>95){
            seekBar.setVisibility(SeekBar.INVISIBLE);
                        //code
    
        }
    
    public void onStopTrackingTouch(SeekBar seekBar) {
        seekBar.setProgress(0);
    
    }
    

    Thanks