【发布时间】:2011-08-09 10:07:56
【问题描述】:
我正在设计一个应用程序,它通过单击按钮从 sqlite 数据库中获取数据。仅当过程很长(例如超过 3 秒)时,我才想在获取期间显示等待消息或进度条。否则它可以继续程序。我该怎么做呢 。我尝试使用以下代码显示进度对话框,但它只等待指定的睡眠时间并继续进行而不显示任何内容....请帮助
protected void GetOrders()
{
ProgressDialog dialog = null;
try
{
dialog=ProgressDialog.show(loginScreen.this,"PLEASE WAIT","LOADING CONTENTS ..",true);
//Accesses database
allOrders=ProductionOrdersBL.GetOrder();
Thread.sleep(4000);
}
catch(Exception e){}
finally
{
dialog.dismiss();
}
}
【问题讨论】:
标签: android multithreading dialog thread-safety waithandle