Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference

后端 未结 6 654
忘了有多久
忘了有多久 2021-02-07 01:46

I have BitmapScalingHelper.java:

public class BitmapScalingHelper
{
    public static Bitmap decodeResource(Resources res, int resId, int dstWidth, int dstHeigh         


        
6条回答
  •  孤街浪徒
    2021-02-07 02:22

    Well, I got this error repeatedly, and my fix for this problem is to make sure you use a .png image as the bitmap image and save it in the drawable folder. Previously I was using it as a vector asset. This worked fine for me.

提交回复
热议问题