Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-20236

Windows: Downloaded image not show in ImageView

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 5.1.2
    • Fix Version/s: Release 5.3.0
    • Component/s: Windows
    • Environment:
    • Story Points:
      8
    • Sprint:
      2016 Sprint 3 SDK

      Description

      I create a simple alloy app and I download some remote image with this function

      var dir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'myAppDir');
      dir.createDirectory(); // this creates the directory
      Alloy.Globals.directory = Ti.Filesystem.applicationDataDirectory + "myAppDir/";
      var dirCat = Titanium.Filesystem.getFile(Alloy.Globals.directory,'categorie');
      dirCat.createDirectory(); // this creates the directory
      Alloy.Globals.directoryCategorie = Ti.Filesystem.applicationDataDirectory + "myAppDir/categorie/";
       
      function downloadImmagineCategoria(url,nome){
      	var xhr = Titanium.Network.createHTTPClient();
      	xhr.onload = function() {
      		var file = Ti.Filesystem.getFile(Alloy.Globals.directory,'categorie',nome);
      		file.write(this.responseData,false);
      	};
      	xhr.open("GET",url);
      	xhr.send();
      }
      

      in another controller I load the downloaded image and I put them in a tableview with this code, and I want the image as a background (I included in the code all the test that I've done)

      //
      //.... some code where I defined _listCat and tableData
      //
       
      var fileImmagine = Ti.Filesystem.getFile(Alloy.Globals.directory,'categorie',_listCat[i].default_image); //name of the image that I download 
       
      var row = Ti.UI.createTableViewRow({
         className:'sceltaCategoriaRow', // used to improve table performance
         backgroundColor: '#bbb',
         rowIndex: _listCat[i].id, // custom property
         height:"162dp"
      });
      var image = Ti.UI.createImageView({
         image : fileImmagine,  //this doesn't work on Windows Phone but works on Android
         //****image: fileImmagine.nativePath,  //this doesn't work on Windows Phone but works on Android
         //*****image: "img/someimage.png",  //this works on both platform but someimage.png is an image that  I've already in my app and not the downloaded one
        width: Ti.UI.FILL, height: Ti.UI.FILL,
      });
      row.add(image);
      var labelUserName = Ti.UI.createLabel({
         color: Alloy.Globals.white,
         width: '80%',
         textAlign: 'center',
         font:{
                    fontFamily: Alloy.Globals.customFont, 
                    fontSize: '18sp',
                 },
          text: _listCat[i].name,
          width:200, height: 30
      });
      row.add(labelUserName);
       
      tableData.push(row);
      

        Attachments

          Activity

            People

            • Assignee:
              gmathews Gary Mathews
              Reporter:
              AlbWebbergate Alberto Bonacina
              Tester:
              Josh Longton
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • It looks like Backbone Issue Sync is not enabled for your project.

                  Git Source Code