【发布时间】:2014-01-16 11:21:18
【问题描述】:
我要在 postexecute 上显示进度条并且在 postExecute 中不可见,它可以工作,但会使应用程序运行非常缓慢,原因是什么原因有什么简单的方法可以使它正常工作(不慢) ? 这是我的代码:
bar = (ProgressBar) this.findViewById(R.id.progressBar);
getInfo extends AsyncTask<void, void, void>{
protected void onPreExecute() {
bar.setVisibility(View.VISIBLE);
}
protected void doInBackground(String... params)
do smth}
protected void onPostExecute(Boolean results) {
bar.setVisibility(View.GONE);
}
}
【问题讨论】:
-
从哪里调用异步任务
-
通过编辑您的帖子发布调用 asynctask 的代码。
-
如果我输入代码,它会以正常速度开始工作吗:“bar.setVisibility(View.VISIBLE);”我在哪里调用 asynctask,并留下代码:“bar.setVisibility(View.GONE);”在 onPostExecute?再次感谢你:)
-
我要求您通过编辑您的帖子在 stackoverflow 上发布代码,以便我或其他人能够提供帮助
标签: android android-asynctask progress-bar