I try to update seekBar when playing, I take the melodies from the array, everything is played and works correctly, I cannot update the seekBar, that is, when the bar is moved, the melody is repeated again and the sekbar does not move. I call in:
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootViewB = inflater.inflate(R.layout.fragment2, container, false); seekBar = (SeekBar)rootViewB.findViewById(R.id.sbar); View rootView = inflater.inflate(R.layout.fragment, container, false); startMediaPlayer(); setSeekBar(); public void startMediaPlayer(){ mediaPlayer = new MediaPlayer(); mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mediaPlayer.start(); } }); ///////////// mediaPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() { @Override public void onBufferingUpdate(MediaPlayer mp, int percent) { seekBar.setMax(mp.getDuration()); seekBar.setSecondaryProgress(mp.getDuration() / 100*percent); seekBar.setProgress(mp.getCurrentPosition()); * } }); }