Lazy Loader ImageLoader位图是否为空?

时间:2013-03-12 11:39:11

标签: android bitmap null lazy-loading

我目前正在使用Lazy Loading方法获取我的listView数据以填充活动。这使用了一个imageLoader,它应该使用传递给它的url,然后创建该图像的位图,但是当我在手机上运行应用程序时,位图始终为null,当我在虚拟设备上运行它时很好。 imageLoader的代码如下:

public void DisplayImage(String url, ImageView imageView)
    {
        imageViews.put(imageView, url);
        Bitmap bitmap=memoryCache.get(url);
        if(bitmap!=null)
            imageView.setImageBitmap(bitmap);
        else
        {
            queuePhoto(url, imageView);
            imageView.setImageResource(stub_id);
        }
    }

剩下的代码真的是相同的,我很困惑为什么图像会加载到虚拟设备而不是物理手机上,这是一个星系s3 btw:)

当我在手机上运行应用程序时,我已经包含了我在LogCat中收到的消息,当我在虚拟设备上运行应用程序时,我没有得到这些消息:

GC_CONCURRENT freed 3707K, 19% free 22988K/28103K, paused 3ms+14ms, total 93ms
java.io.FileNotFoundException: /storage/sdcard0/LazyList/1854873700: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:416)
at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
at com.skystalker.wedcon.ImageLoader.getBitmap(ImageLoader.java:74)
at com.skystalker.wedcon.ImageLoader.access$0(ImageLoader.java:56)
at com.skystalker.wedcon.ImageLoader$PhotosLoader.run(ImageLoader.java:134)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
at libcore.io.IoBridge.open(IoBridge.java:400)
W/System.err(23156):    ... 11 more
D/dalvikvm(23156): threadid=1: still suspended after undo (sc=1 dc=1)

我希望有人可以帮助阐明这一点:)

0 个答案:

没有答案