Glide You cannot start a load for a destroyed activity

https://github.com/bumptech/glide/issues/1484

非常好的解决方式


final Context  context = getContext();
if (isValidContextForGlide(context) {
      // Load image via Glide lib using context
}

public static boolean isValidContextForGlide(final Context context) {
        if (context == null) {
            return false;
        }
        if (context instanceof Activity) {
            final Activity activity = (Activity) context;
            if (activity.isDestroyed() || activity.isFinishing()) {
                return false;
            }
        }
        return true;
}



你可能感兴趣的:(Glide You cannot start a load for a destroyed activity)