gpt4 book ai didi

java - 发布进度?

转载 作者:行者123 更新时间:2023-11-29 09:35:43 24 4
gpt4 key购买 nike

为什么根据 eclipse 这不是有效的:

        protected String doInBackground(String... arg0) {

publishProgress(10);

if(true){
//validate with DB
}else{
//send to registration screen
}

return null;
}

//Update Progress
protected void onProgressUpdate(Integer... values) {

mProgress.setProgress(values[0]);

}

Eclipse 是这样说的:

publishProgress(10);  <<publishProgress(Void) is not acceptable for type publishProgress(Int)

但是这里的其他问题表明它是以这种方式使用的。是 API 的变化吗?我真的很想向 publishProgress 传递一个字符串和 int。这可能吗:

publishProgress("Starting Validation", 10);  

TIA

最佳答案

确保您在泛型参数中声明了正确的类型,例如:

new AsyncTask()<Void, Integer, Void>{ ...

AsyncTask<Params, Progress, Result> :

关于java - 发布进度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15072123/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com