Steps to reproduce:
- Uninstall the app from the device if already installed. (Will delete cached web responses.)
- Make sure the Android device has Internet access.
- Set "tiapp.xml" file property "run-on-main-thread" to true.
- Build and run the below code.
- Notice that the app crashes/hangs on app startup.
When the ImageView property autorotate is set to true, it will attempt to read the image's EXIF rotation if applicable. Since the image file is not in storage, it will attempt to re-download the image on the main UI thread, but Android's Java HttpUrlConnection class will throw a NetworkOnMainThreadException when attempting to do so.
You can do one of the following to work-around this issue...
- Set "tiapp.xml" property "run-on-main-thread" to false.
- Download the image file to storage via HTTPClient and display the download file instead of a URL.
- Set ImageView property "autorotate" to false.