我想在我的视图加载之前显示一个进度对话框。首先,我在 onCreate() 中编写了代码,但在这种情况下不会出现对话框。所以我在 onResume() 中写了它,但在这种情况下,即使在视图加载后它也不会消失。谁能告诉这里出了什么问题?
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
dialog = ProgressDialog.show(this, "", "Please wait...", true);
//dialog.cancel();
new Thread()
{
public void run()
{
try
{
sleep(1500);
// do the background process or any work that takes time to see progress dialog
}
catch (Exception e)
{
Log.e("tag",e.getMessage());
}
// dismiss the progressdialog
dialog.dismiss();
}
}.start();
citySelected.setText(fetchCity);
spinner.setSelection(getBG);
}