Project: titanium
Issue TIMOB-14991: Android: Javascript can't get path of assets folder of module
h6.Problem Client is trying to get images from Android Titanium Module and refer to them via Javascript. So instead of return a TiBlob they would like to get path access resolved so they just have to link image in their image proxy on a similar way like: {code} var image = Ti.UI.ImageView({ image: '/modules/com.mod-id.org/images/image.png' }); {code} "image.png" would be contained at "/RootModuleFolder/assets/image.png" As the assets/README suggests, if you put the image.png in an "images/" subdirectory under assets. Then try to refer to it from a Javascript file. h6.assets/README {code} Place your assets like PNG files in this directory and they will be packaged with your module. If you create a file named org.appcelerator.wifissid.js in this directory, it will be compiled and used as your module. This allows you to run pure Javascript modules that are pre-compiled. {code} h6.Steps to reproduce Create the scenario as follows: 1) Create android module 2) Create directory in assets call 'images' 3) Put an image.png in assets/images 4) Create a test app 5) Replace app.js with snippet below. 6) Public the android module into the Test app 7) Launch the test app in an Android Device 8) Notice how nothing shows up If you create an iOS module in the same way as the android module and you publish it, when running the test app on an iOS device, you'll see the image. h6.A Snippet {code} var win = Ti.UI.createWindow({ backgroundColor: 'yellow' }); var view1 = Ti.UI.createImageView({ top: 0, left: 0, height: Ti.UI.SIZE, width: Ti.UI.SIZE, // works for iOS, doesn't work for android image: '/modules/com.mod-id.org/images/image.png' }) win.add(view1); win.open(); {code} h6.Additional details If you try any of these paths and attempt to use a TiUIImageView warning below is thrown as a drawable reference: {code} //None of these paths worked //var imagePNG = '/modules/org.appcelerator.org/yes.png'; //var imagePNG = '/modules/org.appcelerator.org/assets/yes.png'; //var imagePNG = 'modules/org.appcelerator.org/assets/yes.png'; //var imagePNG = '/org.appcelerator.org/assets/yes.png'; var win = Ti.UI.createWindow({ backgroundColor: 'yellow' }); var image = Ti.UI.createImageView({	top: 150,	image: imagePNG }); win.add(image); win.open(); {code} - 08-27 09:56:56.778: W/TiDrawableReference(3030): (pool-3-thread-2) [632,632] Could not open stream to get bitmap Other than parity, this can be just a TIDOC issue. But from javascript how does one refer to an image that's included as part of an android module?
Story points: 13