Skip to content

Commit 2b96a49

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents e088a4a + c8bb8d4 commit 2b96a49

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

android/src/main/java/org/devio/rn/splashscreen/SplashScreen.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.app.Activity;
44
import android.app.Dialog;
5+
import android.os.Build;
56

67
import java.lang.ref.WeakReference;
78

@@ -65,13 +66,24 @@ public static void hide(Activity activity) {
6566
}
6667
activity = mActivity.get();
6768
}
69+
6870
if (activity == null) return;
6971

70-
activity.runOnUiThread(new Runnable() {
72+
final Activity _activity = activity;
73+
74+
_activity.runOnUiThread(new Runnable() {
7175
@Override
7276
public void run() {
7377
if (mSplashDialog != null && mSplashDialog.isShowing()) {
74-
mSplashDialog.dismiss();
78+
boolean isDestroyed = false;
79+
80+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
81+
isDestroyed = _activity.isDestroyed();
82+
}
83+
84+
if (!_activity.isFinishing() && !isDestroyed) {
85+
mSplashDialog.dismiss();
86+
}
7587
mSplashDialog = null;
7688
}
7789
}

0 commit comments

Comments
 (0)