×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Sep 2013
    Posts
    50

    CacheMap for Images

    I'm using LWUIT for Series 40. I have a list with a lot of images, so I want to use CacheMap to store them as explained here: http://stackoverflow.com/a/8424183/1512982

    However, when it gets to the point where it needs to write to the storage, I get this exception:

    Code:
    java.io.IOException: Object type not supported: com.sun.lwuit.Image
     - com.sun.lwuit.io.util.Util.writeObject(Util.java:184)
     - com.sun.lwuit.io.util.Util.writeObject(Util.java:190)
     - com.sun.lwuit.io.Storage.writeObject(Storage.java:163)
     - com.sun.lwuit.io.CacheMap.placeInStorageCache(CacheMap.java:193)
     - com.sun.lwuit.io.CacheMap.placeInStorageCache(CacheMap.java:169)
     - com.sun.lwuit.io.CacheMap.put(CacheMap.java:95)
     - com.appiphanyinc.picfeed.renderers.FeedListRenderer$PostImageResponseListener.actionPerformed(FeedListRenderer.java:282)
     - com.sun.lwuit.util.EventDispatcher.fireActionSync(EventDispatcher.java:312)
     - com.sun.lwuit.util.EventDispatcher.access$300(EventDispatcher.java:38)
     - com.sun.lwuit.util.EventDispatcher$CallbackClass.run(EventDispatcher.java:85)
     - com.sun.lwuit.Display.processSerialCalls(Display.java:1002)
     - com.sun.lwuit.Display.edtLoopImpl(Display.java:880)
     - com.sun.lwuit.Display.mainEDTLoop(Display.java:839)
     - com.sun.lwuit.RunnableWrapper.run(RunnableWrapper.java:119)
     - java.lang.Thread.run(), bci=5

    Am I really not able to store Images via CacheMap? The link above seemed to suggest it as a solution.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,740

    Re: CacheMap for Images

    LWUIT is open source, you can find a version of writeObject here: https://projects.developer.nokia.com...util/Util.java
    As you can see it supports built-in types, and whatever happens to be Externalizable. Image (https://projects.developer.nokia.com...uit/Image.java) is neither of the two.
    Remember that Image is a user interface object, while someone would expect it to be a simple array with width and height, if you check the implementation you will see that it is tightly bound to Display. And UI elements usually do not support serialization, it is not Java or LWUIT, but a general thing.

  3. #3
    Registered User
    Join Date
    Sep 2013
    Posts
    50

    Re: CacheMap for Images

    I see. Thank you!

  4. #4
    Regular Contributor
    Join Date
    Dec 2012
    Location
    India
    Posts
    271

    Re: CacheMap for Images

    As an alternative, you could write those Images into the file system instead of storage.You may have to encode it into a PNG or JPEG image before writing it (may not be necessary in your case,not sure though!).The ImageDownloaderService has write to File System option, which you could use for your purpose.

    I agree File I/O is slow,but with the right combination of weak references and caching to File System, you can atleast get rid of Memory problems, which, usually the main problem while dealing with large number of Images.

Similar Threads

  1. problem getting the images from images.google.com..!!!
    By buffon2009 in forum Mobile Java General
    Replies: 1
    Last Post: 2011-01-19, 01:43
  2. Replies: 5
    Last Post: 2009-07-20, 18:41
  3. Replies: 5
    Last Post: 2009-03-09, 08:24
  4. gif images
    By bluebelle_88 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2007-02-02, 10:03
  5. Drawing PNG images against Array Images
    By melas21 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2004-01-19, 21:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×