Lecture 6 : Creating Music Player and How to Use Seekbar in Android Studio

Поделиться
HTML-код
  • Опубликовано: 24 сен 2024
  • Hey guys, in this quick tutorial we will learn, how to read the progress out of a SeekBar using the OnSeekBarChangeListener Interface.
    we will also see how to create a media player in android using android studio from scratch along with other android tips.

Комментарии • 5

  • @Sydewinder890
    @Sydewinder890 2 года назад +2

    This works! Thanks

  • @jayadevpu5871
    @jayadevpu5871 2 года назад +7

    Hey Bro, there's a bug.
    The Timer() executes after each interval/period, and the seekbar progress gets changed. When any change to the seekbar is encountered, then the player is moved to that position (using seekTo()) and the song is made to resume from that position).
    i.e, When the progress in the Timer() gets updated, the player/media which is currently playing just moves to that position. The 'Seekbar.setOnSeekBarChanged()' function counts/executes on each execution/update of Timer() function. That's why the song gets stuck while playing in the emulator or on any device. That's not an emulator ram issue.
    To fix this,
    SYNTAX - onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
    >>> use the boolean fromUser parameter -
    >>>boolean: True if the progress change was initiated by the user.
    This parameter helps to avoid the changes made by the system.
    Eg :
    seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
    @Override
    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if(fromUser)
    player.seekTo(progress);
    }
    });
    Bro, gimme a thumbs-up👍, if it works😎

  • @JooseLekaa
    @JooseLekaa 5 месяцев назад

    I want to make in my gallery

  • @waldemirpaixao5636
    @waldemirpaixao5636 Год назад

    Thank You!