Skip to content Skip to sidebar Skip to footer

Java.lang.NullPointerException In Android.util.LruCache.put ( Android )

I'm getting this crash exception in my google Crashes & ANRs section for my app java.lang.NullPointerException in android.util.LruCache.put I have no idea what's wrong I do nee

Solution 1:

public static Bitmap createVideoThumbnail (String filePath, int kind)

Create a video thumbnail for a video. May return null if the video is corrupt or the format is not supported.

So, Might be bitmap value is null. to avoid this Write your code like this:

if(bitmap != null)
{
addBitmapToMemoryCache(String.valueOf(params[0]), bitmap);
}

Solution 2:

It's because ThumbnailUtils.createVideoThumbnail() can return null
So you will need to add check NPE for the bitmap in addBitmapToMemoryCache() method


Post a Comment for "Java.lang.NullPointerException In Android.util.LruCache.put ( Android )"