A new tech tip on the SunSM Developer Connection (SDN) illustrates how to reduce the size of applications to lower the overall MIDlet suite size. C. Enrique Ortiz explains using a local cache and utility classes such as ImageRmsUtils.java and NetworkUtils.java.
Ortiz states "the local cache covered in this article uses the code and the lessons previously covered in the article Externalizing Resources - Persisting Images in RMS. Note that the concepts described here are applicable to other types of resources beyond images." A link to that previous article is on the SDN site in his tech tip, "Implementing a Local Cache to Manage Resources".
Figures online show image cache inheritance and association, ImageCache RMS record store formats and an image cache block diagram.
Code shows steps such as how to load an image from the image cache and finding the Uniform Resource Identifier (URI) over the network.
An additional section of the tech tip explains the image cache Java files ImageCache.java and ImageCacheListener.java. Also covered is the setListener() method, the ImageCacheListener interface, ImageCache public methods and how to clear the cache and check for expiration of image resources.
Be sure to see the list of considerations and possible enhancements Ortiz concludes with. The tech tip is at this link online.
Read More ...