Search code examples
androidandroid-mediaplayerseekbar

Android: seekbar change detect by user only


I use below code:

seekBar = (SeekBar) findViewById(R.id.seekBar);
if(seekBar != null) {
    seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onStopTrackingTouch(SeekBar arg0) {
            Log.i("errorCheck", "VOL7: " + seekVolume);
        }

        @Override
        public void onStartTrackingTouch(SeekBar arg0) {
            Log.i("errorCheck", "VOL8: " + seekVolume);
        }

        @Override
        public void onProgressChanged(SeekBar arg0, int progress, boolean arg2) {
            // code here
        }
    });
}

onProgressChanged work fine, but i cant detect changed by user or by android player

How I can detect user progress change and set new duration to my media player?


Solution

  • It is arg2 you're looking for. It is true when the user changed the value of seekbar. In fact in the documentation it is referred to as fromUser