Appcelerator (Alloy). What if I cannot set image URL to ImageView object.

The most likely you just use a url without a image extension. I use little library before i set URL into ImageView. I name it imagePath.js:

exports.fixExtension = function(path) {
	var checkPathEndForExtMask = /\.jpg|\.jpeg|\.png|\.gif$/;
	if (!checkPathEndForExtMask.test(path)) {
		if (path.indexOf("?") > -1) {
			path += "&.jpg";
		} else {
			path += "?.jpg";
	return path;

Example of usage:

var imagePath = require('imagePath');
$.imgPicture.image = imagePath.fixExtension(user.get('picture'));

The library method basically adds an extension in the end of URL if there is no any url, it is .jpg by default.

Books to read

Comments are closed.