*>       java.lang.NullPointerException
>       at java.util.LinkedHashMap.postRemove(LinkedHashMap.java:291)
>       at java.util.HashMap.remove(HashMap.java:637)
>       at java.util.LinkedHashMap.addNewEntry(LinkedHashMap.java:186)
>       at java.util.HashMap.put(HashMap.java:411)
*

Look for a "Caused By" line...  With a null pointer exception that is the
first thing I look for.  It should contain more information about what
exactly is causing the null pointer exception.  The portion that you posted
is just showing where the problem occurred.

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Fri, Jun 17, 2011 at 10:57 AM, fr4gus <[email protected]> wrote:

> I'm using a LinkedHashMap as cache. I've overridden removeEldestEntry
> in order to force this cache to have a fixed size. Older values will
> be removed. This is how my map is initialized:
>
>        sBackgroundBitmapCache = new LinkedHashMap<String,
> Bitmap>(backgroundCacheSize) {
>            private static final long serialVersionUID =
> 287204858147490218L;
>
>            @Override
>            protected boolean
> removeEldestEntry(LinkedHashMap.Entry<String, Bitmap> eldest) {
>                if (size() > backgroundCacheSize) {
>                    Log.d(TAG, "Removing hash " + eldest.getKey() + "
> from background cache");
>                    return true;
>                } else {
>                    return false;
>                }
>            }
>        };
>
> So obviously I'm going to use that cache using put method. But I'm
> getting crash reports, when using put method:
>
>        java.lang.NullPointerException
>        at java.util.LinkedHashMap.postRemove(LinkedHashMap.java:291)
>        at java.util.HashMap.remove(HashMap.java:637)
>        at java.util.LinkedHashMap.addNewEntry(LinkedHashMap.java:186)
>        at java.util.HashMap.put(HashMap.java:411)
>
> I haven't been able to find why, using put method, may cause a
> nullpointer exception. I'm 100% sure, key and value are not nulls.
>
>
> Any help will be appreciated.
>
> -f4
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to