我开始AsyncTask
加载一个需要一些时间的文件。为了通知用户我正在显示一个ProgressDialog
,但是如果我触摸屏幕,它会ProgressDialog
立即关闭。这可能是什么原因?
public LoadTask(Activity activity, FaceRecognizer recognizer,SecretKey key) {
this.key = key;
this.recognizer = recognizer;
dialog = new ProgressDialog(activity);
}
@Override
protected void onPreExecute() {
dialog.setMessage("Loading the recognizer...");
dialog.show();
}
@Override
protected Boolean doInBackground(Void... params) {
recognizer.load(key);
return null;
}
@Override
protected void onPostExecute(Boolean result) {
if (dialog.isShowing()) {
dialog.dismiss();
}