Titanium Studio and Mobile SDK 1.7 createImageView no longer works?

Hello, I just downloaded the new Titanium Studio IDE and began porting my 1.6 mobile app over to 1.7

Everything seems to work (Other than Blackberry SDK downloads) but my createImageView() call doesn't display an image.

It's storing SOMETHING in memory, because I can get the properties that I set on the javascript object (img.image , img.top etc…) but the image doesn't show up.

It used to with 1.6.2

Heres the code:

var logo = Ti.UI.createImageView({
    image:    'images/bcbswny_logo_homescreen.gif',
    top:    getHeightPercent(5),
    left:    getWidthPercent(10)

and I do add it to my window, all my other widgets work, even the ones that use the backgroundImage property.

Testing it on Android 2.2

— asked 4 years ago by Damon McKernan
  • After doing some testing it seems the image view is being created but the image property doesn't pull in the image.
    I set the backgroundColor to white and that is showing up where it should, just no image.

    — commented 4 years ago by Damon McKernan
  • Just to test, have you tried replacing with a PNG or JPG? The GIF night be causing the problem.

    — commented 4 years ago by Kosso
  • Path's are resolved differently in 1.7, as far as I can tell. It will be relative to whatever directory the js file resides in, rather than the app root.

    If the images directory is on the same level as the js file you are creating the image view from, try adding "./" to the beginning of the url. (Or ../ if it's one level higher).

    — commented 4 years ago by Russell Munson
  • I just re-installed the entire IDE with no success, but I also ran it from command line and through command line the imageview shows the image.

    That's so bizarre.

    — commented 4 years ago by Damon McKernan
  • How about if you use Titanium Developer instead of Titanium Studio? I wonder if this has anything to do with the 'fastdev' server for Android?

    — commented 4 years ago by Kosso
  • Works in Developer too

    — commented 4 years ago by Damon McKernan

13 Answers

  • Accepted Answer

    Similar problem with ImageView. I've coded an ImageView with an array of PNG files to provide a custom activity indicator/spinner/hourglass. It stopped working when I went to Studio, Windows 7 + Android SDK Emulator + Titanium Mobile SDK 1.7.0. However, my app targets both iOS and Android. When I build and execute the same thing on my Mac, it works fine. Let me say that again – it works fine on BOTH the Android emulator and the iOS emulator on my Mac. I believe the problem lies somewhere in the Android FastDev build implementation on Windows. Something isn't right on Windows and it's probably some kind of pathing, space in the path or other issue. I've removed and reinstalled Titanium, the SDK, the JDK, Android SDK and reinstalled in different places. Nothing seems to work. No images in an ImageView. The same images display fine as a background to a Button.

    Bottom line: I don't believe this is a problem with your image or your code. I believe this is an issue with Titanium on Windows. If you have access to a Mac, move your project there and try it. If it works, that will confirm the issue and the Appecelerator folks need to investigate. (I know Appcelerator folks prefer Macs but I recommend that you ask your Android team to use Windows so it's a priority for them.)

    Does anyone know how to disable fastdev? I've looked at all the dials and guages in Studio but I cannot find a way to disable it. I've also tried to Install the app on a device and it seems to want a real device. Does anyone know how to do a build without FastDev? Then I can manually install and see if my suspicions are correct. I guess I could borrow a friend's Android phone, install it there and then move it to the emulator. Unless there's a way to test this, I guess my next stop is digging into the labyrinth of Python crap to figuring out a way to get rid of fastdev to see if it's truly causing the problems.

    One last thing, I tried the apk built for my Mac's Android emulator. It worked find in the PC emulator. This further implies a build problem with Studio on Windows.

    — answered 4 years ago by Robert R Radina
    • Work around: Elsewhere here in the forum, I found this:

      <property name="ti.android.fastdev" type="bool">false</property>

      Add this to your tiapp.xml file, rebuild and see if the images work. This disables FastDev. I know this isn't a "good" thing, since FastDev is a desired feature, but at least the problems will go away until Appcelerator fixes FastDev.

      — commented 4 years ago by Robert R Radina
    • I can confirm that this does solve the issue, although it is VERY inconvenient. If you're listening Appcelerator, please fix this ASAP!

      — commented 4 years ago by Steven Mirabito
    • Has this been fixed? Trying to use createImageView function on windows emulator and still does not show the image on emulator?

      — commented 4 years ago by Bejoy Nair
    • As far as I can tell, this still isn't fixed on Windows 7 with Titanium Studio 1.7.3. Turning off FastDev isn't a good solution for my project, where my Resources dir contains over 2k images – building a full APK takes a few minutes, vs instant debugging with FastDev. Please fix!

      — commented 4 years ago by Nicholas Jansma
    • Still the same in 1.7.5. Win 7(64)
      I wasted a day trying to work out why Kitchen sink could load an image and my application couldn't until I came across this!
      However in Kitchen Sink, Fastdev isn't turned off but the following has the same effect:

      <property name="ti.android.debug" type="bool">false</property>.

      Really Appcelerator, we paid for this stuff - sort it out!!!!!

      I'm also looking at MonoDroid which seems to give a lot more control over the whole application - may be making a move!

      — commented 4 years ago by Simon Jackson
    • This problem is still here in 1.8 on Windows 7. This is just sux. I need to reinstall the app on the emulator, every time I modify something and it takes 3-5 minutes. I think Appcelerator just doesn'T care about Win users…

      — commented 4 years ago by Rapid Phoenix
  • Hi everyone!!!…After three days of trying different codes…ImageViews don't work as they should in 1.7.0. For now on I continue my develop using the ImageView as a backgroundImage instead using the property image. That's the problem when you don´t have a MAC…haha..

    I hope they fix it as soon as they can or the develop is going to be horrible!!!

  • Hello!

    I am working on Linux with Titanium Mobile 1.7.1, fastdev enabled (developping for Android only).

    For me images work perfectly without fastdev, but not when fastdev is enabled.

    The application starts and just hangs on the splash screen until Android's "Application not responding" error appears. I tested with a new blank project and it seems to make no difference if I use createImageView or createView with backgroundImage.

    Both seem to have the same problems. Filename also seems to make no difference, but maybe the IMAGE SIZE!!

    I was testing with png files (which did not work) and started to resize them (on commandline with ImageMagick's commandline tool 'convert'). I made them smaller and smaller until it suddenly worked.

    It did not work with a 270x202 pixel (95929 byzes) file.
    But when I resized the very same file to 200x150 Pixel (50030 bytes) IT DID WORK.

    Same picture, same filename, just different size.

    So maybe it's a (file-)size related problem?

    — answered 4 years ago by John Zweng
    • Tested the same project with Titanium mobile sdk 1.7.2 (did a full rebuild):

      Still not working.

      Application hangs (Application not rtesponding error) when using a 95.929 byte picture, but working fine with 50.030 byte picture (of course only when using fastdev, without fastdev everything is fine).

      — commented 4 years ago by John Zweng
    • Sorry, forget my las t comment! The problem seems to be fixed in mobile SDK 1.7.2!

      I just forgot to switch my project to the new SDK version before rebuilding it. Just changed it in tiypp.xml and rebuilt, and now it works!

      Thanks! :-)

      — commented 4 years ago by John Zweng
  • I have been on this for a couple days and finally found the answer that works for me…I hope it works for you.

    set opacity to "1"

    for some reason, default is "0" (off)

    In my experience, I also used the backgroundImage as well as setting height and width for the image…but "opacity:1" was the kicker for me.

  • Does anybody have an answer to this?
    I confirm that it is Fastdev's problem not serving images correctly to ImageViews. Any fix yet?

  • Thanks Jandro, After banging my head for a few hours i got this working using the backgroundImage property rather than image on windows 7 for Android:
    Importantly the height and width needs to be specified

    var logo = Titanium.UI.createImageView({

  • Try adding a slash to the start of the image url. (I seem to remember there being something with Android that caused me problems without it. If that doesn't work, try using app://images/bcbswny_logo_homescreen.gif

    And if that doesn't work, try using a PNG. ;/

    — answered 4 years ago by Kosso
    • None of the three worked. If I use the same path to the image as a backgroundImage for a different view it displays correctly so I imaging the path is correct.

      It looks like it's setting the width and height to zero, but if I give them valid numbers I still don't see anything… top and left are within view too.

      — commented 4 years ago by Damon McKernan
    • This one worked for me! thanks

      — commented 4 years ago by Danny Vernovsky
  • Path's are resolved differently in 1.7, as far as I can tell. It will be relative to whatever directory the js file resides in, rather than the app root.
    If the images directory is on the same level as the js file you are creating the image view from, try adding "./" to the beginning of the url. (Or ../ if it's one level higher).

    (sorry, this is a duplicate of a comment I made… posted to the wrong spot originally).

    — answered 4 years ago by Russell Munson
    1 Comment
    • Tried adding the dot too, nothing. I managed a workaround by using just a view and setting the background image to the path (which worked) but I have to hard code the image size in for height and width (or else it stretches) I'd still like to know why it didn't work for imageView though.

      — commented 4 years ago by Damon McKernan
  • Hi,
    I just did some very simple tests on Android 2.2 using Ti SDK 1.7 and all image urls worked - eith in the Resources folder, or in an images folder.

    Test with a JPG, PNG and even an animated GIF (though the animation did not work, as expected).

    // very basic app.js
    // test.png in an images folder in Resources
    var win = Titanium.UI.createWindow({
        backgroundColor: "#FFFFFF"
    var test = Ti.UI.createImageView({

    Could you try using another image? I wonder if your GIF is corrupt in some way?

    — answered 4 years ago by Kosso
    1 Comment
    • I've already tried other urls, the gif isn't corrupt because it works in every other view, just not image views. No filetype seems to be working in the image view.

      I've been having a rough time with this IDE, randomly crashing or getting bogged down, maybe I'll uninstall / reinstall. Perhaps something bad happened during my install.

      — commented 4 years ago by Damon McKernan
  • Me too… If I change the sdk to 1.6.2 then the image shows.. but with
    1.7.0 or 1.7.0.RC1 then nothing..

  • What the heck is going on.. look at these,

    images only works in createview, backgroundimage
    header0.png < works and show
    header1.png < CRASH!
    headerB.png < just renamed the header1.png to headerB.png not crash but does not show.

    awww… all works in 1.6.2 , 1.7.0 is a dum dum

  • same here…
    everything works under 1.6.2 but switching to 1.7.0 will make my images disappear.

    what are we doing wrong./?

  • Hello everyone,
    I got into testing this after reading Robert's post. I confirm that the 1.7 SDK has some glitches only under Windows. I use Win7 and I can't see any images compiling with 1.7 (with or without fastdev) but if I switch to OSX, everything works nicely.

    I guess I have to work on the Mac for a while.
    So my next question is: "How do I turn on the fastdev on OSX?"