Skip to content

Commit

Permalink
Android apacheGH-470 InAppBrowser: java.lang.IllegalArgumentException
Browse files Browse the repository at this point in the history
Fix interacting with views when Activity destroyed
Bug description https://stackoverflow.com/questions/22924825/view-not-attached-to-window-manager-crash
  • Loading branch information
Sarafanov Valeriy committed Jan 27, 2020
1 parent 09ad59f commit 3b04f65
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/android/InAppBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ else if (action.equals("show")) {
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (dialog != null) {
if (dialog != null && !cordova.getActivity().isFinishing()) {
dialog.show();
}
}
Expand All @@ -326,7 +326,7 @@ else if (action.equals("hide")) {
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (dialog != null) {
if (dialog != null && !cordova.getActivity().isFinishing()) {
dialog.hide();
}
}
Expand Down Expand Up @@ -537,7 +537,7 @@ public void run() {
childView.setWebViewClient(new WebViewClient() {
// NB: wait for about:blank before dismissing
public void onPageFinished(WebView view, String url) {
if (dialog != null) {
if (dialog != null && !cordova.getActivity().isFinishing()) {
dialog.dismiss();
dialog = null;
}
Expand Down

0 comments on commit 3b04f65

Please sign in to comment.