Skip to content

Commit

Permalink
修复一个异步处理后关闭dialog失败问题
Browse files Browse the repository at this point in the history
  • Loading branch information
liheng committed Jun 1, 2020
1 parent a79dd6c commit 09d10fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;

import com.yanzhenjie.permission.AndPermission;
import com.yanzhenjie.permission.task.WaitDialog;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract class TaskExecutor<T> extends AsyncTask<Void, Void, T> {
private Dialog mDialog;

public TaskExecutor(Context context) {
this.mDialog = new WaitDialog(context);
this.mDialog = new WaitDialog(context.getApplicationContext());
this.mDialog.setCancelable(false);
}

Expand All @@ -46,7 +46,11 @@ protected final void onPreExecute() {
@Override
protected final void onPostExecute(T t) {
if (mDialog.isShowing()) {
mDialog.dismiss();
try {
mDialog.dismiss();
} catch (Exception e) {
e.printStackTrace();
}
}
onFinish(t);
}
Expand Down

0 comments on commit 09d10fe

Please sign in to comment.