无论我尝试什么,Android Seekbar都不会更新

时间:2019-07-14 07:59:43

标签: android seekbar

Seekbar不会更新,不确定是活页夹还是其他螺丝钉。我放弃。

我已经尝试过计时器,可运行,但不会更新。我不确定是我的错还是seekbar,我不知道。我放弃了,我只想问问stackoverflow上的人们,看看你们是否可以帮助我。我已经在这个问题上花费了4多个小时,但这只会减慢我可以做的其他事情。 这是我为Runnable编写的内容:

            public void run() {
                //int curr = player.mediaPlayer.getCurrentPosition();
                try {
                    //why the dirty code?
                    //seekbar.setprogress did not work for me
                    //it refuses to update it's position
                    //i have no idea why and i have no time to look into it.
                    //I was throwing everything at the problem at this point.
                    Log.v("Service Bound", Integer.toString(curr));
                    Toast.makeText(MainActivity.this, "Service Bound!", Toast.LENGTH_LONG).show();
                    songStat.setProgress(0);
                    songStat.setMax(player.mediaPlayer.getDuration());
                    songStat.setProgress(100);
                    curr++;
                }catch(Exception e){

                }
            }
        };
        handler.postDelayed(r, 100);

1 个答案:

答案 0 :(得分:0)

您在初始化Handler时是否尝试过此操作,它将在主线程上运行代码,

Handler handler = new Handler(Looper.getMainLooper());