Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Loading an image into WebView not rendering properly on Android

I am trying to load an image into a WebView in order to allow the user to move it around the screen and do a pinch-zoom on their device. This has worked fine on the iPhone however it seems to fail fairly miserably much of the time on the Android emulator. I have tried re-saving the failing images as PNG's and Jpegs with different colour profiles / DPI settings but to no avail - the output is always like the screenshot here -> [http://imgur.com/lBRQt]

Here is the basic code I'm using, if anyone has any ideas that would be a great help!

var webview = Titanium.UI.createWebView({
            visible: true,
            top: 35,
            height: 445,
            width: 320

webview.url =  './smaller/foto18.jpg';
— asked November 29th 2010 by Boydlee Pollentine
  • android
  • images
  • webview

1 Answer

  • Worked it out, turns out that it can't handle filenames that contains spaces or some other characters (such as brackets or comma's). Just batch renaming the images to remove these characters in the filename seems to work.

    — answered November 29th 2010 by Boydlee Pollentine
    • Thanks for tracking that down. It's a limitation in the underlying filesystem when compiled for device.

      — commented November 29th 2010 by Don Thorp
    • can you pls give answer to this question http://developer.appcelerator.com/question/115691/load-local-image-in-webview

      — commented February 24th 2011 by Manaday Mavani
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.