{ "id": "101607", "key": "ALOY-286", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "14171", "description": "", "name": "2012 Sprint 19", "archived": true, "released": true, "releaseDate": "2012-09-24" }, { "id": "14176", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": false, "released": true, "releaseDate": "2012-12-13" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-09-20T16:26:01.000+0000", "created": "2012-09-20T15:10:05.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "alloy" ], "versions": [ { "id": "14171", "description": "", "name": "2012 Sprint 19", "archived": true, "released": true, "releaseDate": "2012-09-24" } ], "issuelinks": [ { "id": "21139", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "100491", "key": "TIMOB-10783", "fields": { "summary": "Android: Window url is assumed relative to calling js file directory, causes FileNotFoundException", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": null, "updated": "2018-03-07T22:26:10.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "12329", "name": "Runtime", "description": "Generic bucket for uncategorized runtime issues" }, { "id": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "h3. Problem\r\nImage views are not displaying images in Android\r\n\r\nh3. Alloy app\r\nThe _logo.png_ is an image in _assets_ folder\r\n\r\n**index.js**\r\n{code:title=index.js}\r\nfunction doClick(e) { \r\n alert($.label.text);\r\n}\r\n$.logo.image = \"logo.png\";\r\n$.index.open();\r\n{code}\r\n\r\n**index.jss**\r\n{code:title=index.tss}\r\n\".container\": {\r\n\tbackgroundColor:\"white\"\r\n},\r\n\"Label\": {\r\n\twidth: Ti.UI.SIZE,\r\n\theight: Ti.UI.SIZE,\r\n\tcolor: \"#000\"\r\n} \r\n{code}\r\n\r\n**index.xml**\r\n{code:title=index.xml}\r\n\r\n\t\r\n\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\n\r\nBut this in app.js works:\r\n\r\n**app.js**\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n fullscreen: true\r\n});\r\nwin.add(\r\n Ti.UI.createImageView({\r\n image: 'logo.png'\r\n })\r\n);\r\nwin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "Alloy - ImageView is not working in Android", "creator": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "Alloy 0.2.34", "comment": { "comments": [ { "id": "220016", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "A quick fix is to prefix your image paths with a \"/\", so make it \"/logo.png\". This works on all platforms with Alloy. I'm going to investigate further to see why this isn't working for Alloy.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-09-20T15:36:30.000+0000", "updated": "2012-09-20T15:36:30.000+0000" }, { "id": "220030", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Pedro, this is happening because you're trying to access the images with relative paths. It works in standard Titanium because both your app.js and the image file are in the same folder. It does not work in Alloy because index.js is in Resources/alloy/controllers and the image is in Resources.\r\n\r\nFor whatever reason, iOS and Android handle these relative paths differently. iOS makes the \"relative\" path relative to Resources where Android makes it relative to the folder of the currently executing file. Not sure what Mobileweb does. This will need some serious digging to figure out where the differences are, and what the expected behavior should be for all platforms.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-09-20T16:06:54.000+0000", "updated": "2012-09-20T16:06:54.000+0000" }, { "id": "220036", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-09-20T16:25:49.000+0000", "updated": "2012-09-20T16:25:49.000+0000" }, { "id": "220042", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Interesting, I missed that! Anyway, that's good to know, we should document this somehow until the said bug is fixed.\r\n\r\nThanks!", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-09-20T16:34:52.000+0000", "updated": "2012-09-20T16:34:52.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }