Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

图片加载中的时候点击返回直接崩溃 #55

Closed
yuanmenghao opened this issue May 22, 2018 · 6 comments
Closed

图片加载中的时候点击返回直接崩溃 #55

yuanmenghao opened this issue May 22, 2018 · 6 comments

Comments

@yuanmenghao
Copy link

如果图片还在加载中点击返回按钮的话 会直接卡死。在图片预览的时候切换到最后一张图的时候滑动退出,会有一定几率崩溃,

@yangchaojiang
Copy link
Owner

提供一下日志

@yuanmenghao
Copy link
Author

第一个问题没有日志,第一个问题很容易复现,开启2G网,当progressbar在转的时候点返回,直接就卡死了,我在看源码还没找到是什么问题。第二个问题的日志刚才忘复制了,稍后我复制过来

@yuanmenghao
Copy link
Author

老哥,如果图片的路径打不开或者图片还没加载出来的时候点返回,直接就卡死了。这问题很致命啊,帮忙看一下代码需要改哪里,我是下载下来用的本地lib

@yangchaojiang
Copy link
Owner

用图片加载框架如失失败就行了哦

@zt80hou
Copy link

zt80hou commented Jul 26, 2018

image
点开看大图的时候,源码禁用了返回键,必须等图片出来才可以,否则就卡住,这个问题确实不太好。

@songrui
Copy link

songrui commented Jul 2, 2019

老哥,如果图片的路径打不开或者图片还没加载出来的时候点返回,直接就卡死了。这问题很致命啊,帮忙看一下代码需要改哪里,我是下载下来用的本地lib

像作者说的:用图片加载框架如失失败就行了哦

比如用glide加载图片,设置一个加载失败时的占位图就行了:

Glide.with(context).load(path).apply(new RequestOptions().error(R.drawable.ic_default_pic))
.listener(new RequestListener() {
@OverRide
public boolean onLoadFailed(@nullable GlideException e, Object model, Target target, boolean isFirstResource) {
simpleTarget.onLoadFailed(null);
return false;
}

        @Override
        public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
            imageView.setImageDrawable(resource);
            simpleTarget.onResourceReady();
            return false;
        }
    }).into(imageView);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants