Android的AsyncTask的进度条 [英] Android AsyncTask Progress bar
本文介绍了Android的AsyncTask的进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
进度togther与AsyncTask的
我有一个项目一个expandableListView。如果有人点击该组则数据必须加载和加载时间进度条必须come.I希望通过异步任务来做到这一点。请给我的例子code为。 先谢谢了。
I am having a expandableListView in a project . If somebody clicks on the group then data must be load and loading time a progress bar must come.I want to do it by Async Task .please give me example code for that. Thanks in advance.
推荐答案
请试试这个
public class LoadData extends AsyncTask<Void, Void, Void> {
ProgressDialog progressDialog;
//declare other objects as per your need
@Override
protected void onPreExecute()
{
progressDialog= ProgressDialog.show(YourActivity.this, "Progress Dialog Title Text","Process Description Text", true);
//do initialization of required objects objects here
};
@Override
protected Void doInBackground(Void... params)
{
//do loading operation here
return null;
}
@Override
protected void onPostExecute(Void result)
{
super.onPostExecute(result);
progressDialog.dismiss();
};
}
您可以通过调用这个
LoadData task = new LoadData();
task.execute();
这篇关于Android的AsyncTask的进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文