Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-24605

Android: Setting "backgroundImage" to a web URL causes a crash if JS is running on the UI thread

    Details

    • Story Points:
      7
    • Sprint:
      2018 Sprint 16 SDK

      Description

      Summary:
      Setting Android View property "backgroundImage" to a URL will cause a crash if "tiapp.xml" property "run-on-main-thread" is set to true.

      (This also happens with ImageView "defaultImage" property as well.)

      Steps to reproduce:

      1. Uninstall the app from the device if already installed. (Will delete cached web responses.)
      2. Make sure the Android device has Internet access.
      3. Set "tiapp.xml" file property "run-on-main-thread" to true.
      4. Build and run the below code.
      5. Notice that the app crashes/hangs on startup.

      tiapp.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <ti:app xmlns:ti="http://ti.appcelerator.org">
      	<property name="run-on-main-thread" type="bool">true</property>
      </ti:app>
      

      app.js

      var window = Ti.UI.createWindow();
      window.add(Ti.UI.createView({
      	backgroundImage: "http://raw.githubusercontent.com/recurser/exif-orientation-examples/master/Portrait_1.jpg",
      }));
      window.open();
      


      Original Post:
      I am unable to set background image for an imageView using an external URL. It crashes the app, but only if ran via main thread.

      index.xml

      <Alloy>
      	<Window>
      	        <ImageView id="imageView" />
      	</Window>
      </Alloy>
      

      index.js

      var b = "http://www.onlineinstruments.co.in/assets/images/Online%20Logo_PNG.png";
      $.imageView.setBackgroundImage(b);
      

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              isener ILAY SENER
              Reviewer:
              Gary Mathews
              Tester:
              Samir Mohammed
            • Watchers:
              0 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-10616
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code