I want to attach along click action to seekbar to do some thing.
And I tried to do this by implementing setOnLongClickListener
on onStopTrackingTouch
and onProgressChanged
methods and it is not working.
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, final int progress, boolean fromUser) {
textView.setText("" + progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
seekBar.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
ToastMaker("LongPress");
return false;
}
});
}
});
my final goal is to set seekbar's steps 10 or 20 for onProgressChanged
and when user holds seekbar the step value changes to 1 (using incrementProgressBy(1)
method) so user can be able to select exact value on a long range seekbar.
if you use Samsung's Video editor they did same thing. you can scroll through video timeline fast and when you want to select the exact moment you hold the seekbar and you can select exact moment you like(look at the gif bellow)