I have a an Activity which updates the seekbar for the mediaplayer. I found this code on internet.
public class SampleDownload extends AppCompatActivity implements Runnable {
    private Seekbar seeekbar;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        seekBar = (SeekBar) findViewById(R.id.seekBar1);
        startMedia = (Button) findViewById(R.id.button1);
        stopMedia = (Button) findViewById(R.id.button2);
        startMedia.setOnClickListener(this);
        stopMedia.setOnClickListener(this);
        seekBar.setOnSeekBarChangeListener(this);
        seekBar.setEnabled(false);
    }
       ...... code contiunes not shown here
    @
    Override
    public void run() {
        int currentPosition = mp.getCurrentPosition();
        int total = mp.getDuration();
        while (mp != null && currentPosition < total) {
            try {
                Thread.sleep(1000);
                currentPosition = mp.getCurrentPosition();
            } catch (InterruptedException e) {
                return;
            } catch (Exception e) {
                return;
            }
            seekBar.setProgress(currentPosition);
        }
    }
}
If this thread is running on a seperate thread other than the UI. how is it able to change seekbar
