Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6424] Android: Ti.UI.createImageView fails to either find or decode remote initial image

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionWon't Fix
Resolution Date2012-03-12T14:42:45.000+0000
Affected Version/sRelease 1.7.5, Release 1.8.0.1
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterDustin Hyde
AssigneeMarshall Culpepper
Created2011-12-01T15:55:06.000+0000
Updated2017-03-10T19:18:43.000+0000

Description

Ti.UI.createImageView fails to decode image on creation (log attached) in Android 2.2 (NookColor and Emulator). The Android 2.3.6 Device and Tab 3.1 have a separate error of filenotfound (attached), but the iPhone Simulator 5.0 and iPhone 5.0 correctly load and decode the remote image. Local images work in all cases. Android 2.2 Error Log Excerpt: 12-01 14:12:07.093: W/TiDrawableReference(374): (main) [6,1703] Bitmap bounds could not be determined. If bitmap is loaded, it won't be scaled. 12-01 14:12:07.103: D/skia(374): --- SkImageDecoder::Factory returned null 12-01 14:12:07.113: E/TiUIImageView(374): (main) [20,1723] Max retries reached, giving up decoding image source: http://www.zoomout.gr/assets/media/PICTURES/???????/651_thumb1.jpg Android 2.3.6, 3.1 Error Log Excerpt: 12-01 15:11:26.505: E/TiDownloadManager(2872): (pool-3-thread-1) [365,13155] Exception downloading http://www.zoomout.gr/assets/media/PICTURES/???????/651_thumb1.jpg 12-01 15:11:26.505: E/TiDownloadManager(2872): java.io.FileNotFoundException: http://www.zoomout.gr/assets/media/PICTURES/???????/651_thumb1.jpg 12-01 15:11:26.505: E/TiDownloadManager(2872): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:521) 12-01 15:11:26.505: E/TiDownloadManager(2872): at java.net.URL.openStream(URL.java:645) 12-01 15:11:26.505: E/TiDownloadManager(2872): at org.appcelerator.titanium.util.TiDownloadManager$DownloadJob.run(TiDownloadManager.java:134) 12-01 15:11:26.505: E/TiDownloadManager(2872): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088) 12-01 15:11:26.505: E/TiDownloadManager(2872): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581) 12-01 15:11:26.505: E/TiDownloadManager(2872): at java.lang.Thread.run(Thread.java:1019) Steps to Reproduce: 1. Run the following code in a new app.
Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({backgroundColor:'#fff'});
var test_img = Titanium.UI.createImageView({image:'http://www.zoomout.gr/assets/media/PICTURES/ΜΟΥΣΙΚΗ/651_thumb1.jpg'}); 
win.add(test_img);
win.open();
Expected Result: Image should download, decode and display. Actual Result: No image displays, errors log to the console. Android 2.2 has decode errors, Android 2.3.6 has filenotfound errors, iOS Simulators/Devices work correctly. Note: The local image 'KS_nav_ui.png' works as expected across platforms.

Attachments

FileDateSize
2.2 imageview decode error log.txt2011-12-01T15:55:06.000+00004767
2.3.6 filenotfound error.txt2011-12-01T15:55:06.000+00002011

Comments

  1. Hieu Pham 2012-03-12

    This bug has been fixed a while back. The fix is simple in JS:
       
       
       // this is a remote URL with a UTF-8 character encoded. We should be able
       // to fetch this image OK
       
       var test_img = Titanium.UI.createImageView({
       		image: 'http://www.zoomout.gr/assets/media/PICTURES/' + encodeURIComponent('ΜΟΥΣΙΚΗ') + '/651_thumb1.jpg'
       
       }); 
       
       win.add(test_img);
       
  2. Marshall Culpepper 2012-03-12

    It is not possible for us to automatically URL-encode specific portions of URLs, because we can't know if (or what parts) of the URL are safe for encoding. iOS does have some automagic here, but IIRC there are cases where it will break and be too optimistic about encoding (which there is no way to get out of). We provide a method already for allowing explicit control of URL encoding called encodeURIComponent
  3. Lee Morris 2017-03-10

    Closing ticket as the issue will not fix.

JSON Source