Skip to content

UI update thread #40

@seunghee63

Description

@seunghee63

Issue
Seekbar를 다루고있는 Thread에서
ui를 업데이트 하기위해 handler을 사용할 때, 너무 늦게 ui가 업데이트 되는 문제 발생

UI를 다루는 Thread runOnUiThread()

    val tt = object : TimerTask() {
        override fun run() {
            runOnUiThread {
                playTime = String.format(
                    "%02d:%02d",
                    ((mediaPlayer.getCurrentPosition() / 1000) % 3600 / 60),
                    ((mediaPlayer.getCurrentPosition() / 1000) % 3600 % 60)
                )

                tv_main_player_duration_time.setText(playTime)
                seekbar.setProgress(mediaPlayer.getCurrentPosition())
            }
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions