睡眠功能不起作用

Kab*_*bir 2 android andengine

我希望在可更改的文本中显示1到100.我喜欢使用sleep()函数,因此看起来它正在将表单1增加到100.我的代码是

for(int i= 0;i<100;i++) {
    scorelevel.setText(String.valueOf(i));
    try{
        Thread.sleep(1000);
    }catch (InterruptedException e) {
        e.printStackTrace();
    }
}
Run Code Online (Sandbox Code Playgroud)

但它没有正确显示.任何帮助或建议表示赞赏.

Zan*_*Jie 5

不要阻止UI线程,AsyncTask而是使用