Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20236] Windows: Downloaded image not show in ImageView

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-02-02T07:53:51.000+0000
Affected Version/sRelease 5.1.2
Fix Version/sRelease 5.3.0
ComponentsWindows
LabelsimageView, qe-5.3.0, windows, windows_phone
ReporterAlberto Bonacina
AssigneeGary Mathews
Created2016-01-12T11:39:57.000+0000
Updated2016-04-14T19:54:50.000+0000

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);

Comments

  1. Gary Mathews 2016-01-28

    PR: https://github.com/appcelerator/titanium_mobile_windows/pull/540
  2. Josh Longton 2016-04-14

JSON Source