var Utils = {};

(function() {
  Utils.convertTemp = function(temp) {
    if(Ti.App.Properties.getString('units','c')==='f') {
        return Math.round(temp*1.8+32) +'\u00b0F'; // convert to Fahrenheit & append degree symbol-F
    } else {
        return temp +'\u00b0C';
    }    
  };
  
  Utils.weatherIcon = function(iconName) {
    // Determine if this icon is already downloaded.
    var appDir = Ti.Filesystem.applicationDataDirectory;
    var file = Ti.Filesystem.getFile(appDir, 'weathericons/' + iconName);
    // If the file does not already exists, download and store it.
    if (file.exists()) {
      Ti.API.log('Icon ' + iconName + ' exists on device filesystem. Use local file.');
      return appDir + 'weathericons/' + iconName;    
    }
    else {
      Ti.API.log('Icon ' + iconName + ' does not exists on device. Use external URL.');
      return 'http://www.worldweather.org/img_cartoon/' + iconName;
    }
  }
})();

@@ -511,16 +511,21 @@
 nName);%0A
+    %0A
     // I
@@ -535,25 +535,16 @@
 he file 
-does not 
 already 
@@ -556,28 +556,54 @@
 s, d
-ownload and store it
+isplay the file stored on the local filesystem
 .%0A  
@@ -781,100 +781,894 @@
     
-else %7B%0A      Ti.API.log('Icon ' + iconName + ' does not exists on device. Use external URL.'
+// Otherwise, cache the image in the local filesystem, but still%0A    // return the path right away, as caching takes a few seconds.%0A    else %7B%0A      Ti.API.log('Icon ' + iconName + ' does not exists on device. Use external URL.');%0A      var imageView = Ti.UI.createImageView(%7B%0A        image:'http://www.worldweather.org/img_cartoon/' + iconName%0A      %7D);%0A      // Wait a few seconds because it'll take a little bit to download the image.%0A      setTimeout(function() %7B%0A        // Valid images will be 35 pixels wide. Only store those images%0A        // in the local filesystem.%0A        var imageBlob = imageView.toImage();%0A        Ti.API.log('Width of this icon is ' + imageBlob.width);%0A        var file = Ti.Filesystem.getFile(appDir, 'weathericons/' + iconName);%0A        file.write(imageBlob);%0A        Ti.API.log('Successfully created this weathericon file: ' + iconName);%0A      %7D, 5000
 );%0A 

Add caching mechanism for weather icons.