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

点击图标预览报空指针 #74

Open
hardlove opened this issue Jul 12, 2020 · 0 comments
Open

点击图标预览报空指针 #74

hardlove opened this issue Jul 12, 2020 · 0 comments

Comments

@hardlove
Copy link

hardlove commented Jul 12, 2020

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.drawable.Drawable.getIntrinsicHeight()' on a null object reference
at com.lzy.ninegrid.preview.ImagePreviewActivity.computeImageWidthAndHeight(ImagePreviewActivity.java:144)
at com.lzy.ninegrid.preview.ImagePreviewActivity.onPreDraw(ImagePreviewActivity.java:82)

原因: 必须添加

.placeholder(R.drawable.ic_default_image)

NineGridView.setImageLoader(new NineGridView.ImageLoader() {
            @Override
            public void onDisplayImage(Context context, ImageView imageView, String url) {
                Glide.with(context).load(url).placeholder(R.drawable.ic_default_image).error(R.drawable.ic_default_image).into(imageView);

            }

            @Override
            public Bitmap getCacheImage(String url) {
                return null;
            }
        });
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

1 participant