0
private void setheight(String url) {
        int ScreenWdth = Resources.getSystem().getDisplayMetrics().widthPixels;
        int ScreenHeight = Resources.getSystem().getDisplayMetrics().heightPixels;
        new Thread(new Runnable() {
            public void run() {
                try {
                    Drawable drawable = null;
                    drawable = Drawable.createFromStream((InputStream) new URL(url).getContent(), "src");
                    BitmapDrawable bd = (BitmapDrawable) drawable;
                        Bitmap bm = bd.getBitmap();
                        mHolder.mImgSimpleDraweeView.post(new Runnable() {
                            public void run() {
                                int bmWidth = bm.getWidth();
                                double Newwidth = ScreenWdth / (double) bmWidth;
                                int mheight = (int) (bm.getHeight() * Newwidth);
                                mHolder.mImgSimpleDraweeView.setMinimumHeight(mheight);
                           
                                mHolder.mImgSimpleDraweeView.setImageURI(url);
                            }
                        });
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }).start();
    }

我在 null 上遇到了问题 BitmapDrawable.getBitmap()'

我的 firebase crashlyticsBitmap bm = bd.getBitmap();说错了

我使用我的开发人员没有任何崩溃,但在我的 firebase crashlytics 中有。

我的代码有什么错误?或者我错过了什么?

4

0 回答 0