GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-09-27T20:39:26.000+0000 |
Affected Version/s | Release 1.6.2, Release 1.7.2, Release 1.7.3, Release 1.7.5, Release 1.8.0.1, Release 2.1.2, Release 3.0.0 |
Fix Version/s | Release 3.0.0, Sprint 2012-20 API, 2012 Sprint 20 |
Components | Android |
Labels | api, qe-and082012 |
Reporter | Dustin Hyde |
Assignee | Ping Wang |
Created | 2011-12-02T18:10:53.000+0000 |
Updated | 2012-12-05T22:28:36.000+0000 |
Titanium.Network.HTTPClient.send loads text instead of image (log and screenshot attached).
Bug specific to Android 2.x.
Behavior not found in iOS or Android 3.x.
Steps to Reproduce:
1. Run KitchenSink (or KitchenSink-Nook if using the NookColor to have a valid test configuration).
2. Go to Platform > XHR > File Download.
3. Click "Set Web View (Data)".
Expected Result:
Image should display.
Actual Result:
Text displays (screenshot attached). Errors log (attached).
Occurs on: Titanium Studio, build: 2.1.2.201208201549 SDK version: 2.1.2.v20120821160113 Devices: Motorola Droid (2.2.3)
There's a URL in this code that is no longer valid: GET','http://www.appcelerator.com/wp-content/themes/appcelerator/img/a-logo.png In this case, the HTTP server returns a web page that includes some "404" text. If I replace the invalid URL with a valid one here, it works as expected: ttp://codedog.net/wp-content/uploads/2011/09/appcelerator.png This is the same issue as for other tickets with invalid URL's.
On Android, webview.setData(TiBlob data) only works for html-string. It does not work for binary data, eg. image. This is a native Android behavior. In the Android [doc](http://developer.android.com/reference/android/webkit/WebView.html#loadData(java.lang.String, java.lang.String, java.lang.String)), it points out: {quote} The 'data' scheme URL formed by this method uses the default US-ASCII charset. If you need need to set a different charset, you should form a 'data' scheme URL which explicitly specifies a charset parameter in the mediatype portion of the URL and call loadUrl(String) instead. {quote} And there are several related discussion: http://code.google.com/p/android/issues/detail?id=596 http://stackoverflow.com/questions/5267124/how-to-display-image-with-webview-loaddata Will modify the KS test. PR https://github.com/appcelerator-developer-relations/KitchenSink/pull/34
Closing as fixed. Tested on: Titanium Studio, build: 3.0.0.201211301903 Titanium SDK, build: 3.0.0.v20121204181658 Devices: HTC Nexus One (2.2.2)