Page 1 of 1

How to show an image on a card without delay [SOLVED]

Posted: Thu Dec 18, 2014 12:45 am
by William Jamieson
Hello. Quite a simple problem I have for you today. I have a very small image (20kb) that I want to show on a card with minimal loading time on Android and iOS.

Here is the situation. I have a card with a button. I click the button. I want to go to another card with a button with the icon set to my 20kb image in less than 50 milliseconds on an Android device.

Here
Image Test.zip
Here is a sample LC file set up for android deployment
(53.9 KiB) Downloaded 187 times
is a sample stack that demonstrates what I am trying to do. Try it out!

If you have any ideas how to get the time down to less than 50 milliseconds, please let us know because I couldn't find any post about this on the forum.

[When I deployed it to my phone it took 7 seconds]

-Will

Re: How to show an image on a card without delay

Posted: Thu Dec 18, 2014 12:54 am
by Simon
Hi Will,
Replace the answer with
put "Loading the image took " & tS2 && "milliseconds!"
Now how long does it take? :)

Simon

Re: How to show an image on a card without delay

Posted: Thu Dec 18, 2014 5:46 am
by William Jamieson
Hmmm.. Good question. I wouldn't know exactly because the put statement doesn't show any visual feedback on Android. But by the looks of it, about 8 seconds with me counting.

BTW Happy Holidays Simon!

-Will

Re: How to show an image on a card without delay

Posted: Thu Dec 18, 2014 12:55 pm
by Simon
Ahh OK caught me on that one :)
So in testing the delay is in the image quality setting.
With your png;
Normal 27 ms
Good 27 ms
Best 9170 ms

With a 97 KB jpg image
Normal 45 ms
Good 53 ms
Best 106 ms
And yes it has to do with caching the image, if the image is on the first card, then it takes the approx 9 seconds to go from black screen to seeing the card.

Hey I did discover something I didn't know, on my Android device you don't actually have to hit the "OK" btn to make the dialog box go away, just touching the screen does it. Even with multiple responses (with "Yes" or "No" (ackkk!)).
Will, if you can confirm that we should bug it.

Simon
Edit; Hey... your image is 56 KB not 20

Re: How to show an image on a card without delay

Posted: Thu Dec 18, 2014 8:28 pm
by jacque
Besides reducing the resolution, try displaying the image directly on card 2 instead of using it as a button icon, and see if that speeds it up.

Re: How to show an image on a card without delay

Posted: Fri Dec 19, 2014 3:08 am
by William Jamieson
No need Jacque. Simon was absolutely right! There is such a huge difference between setting the quality from 'good' to 'best', it is insane!

Solution: Create a couple sizes of image files that dont have to be resized so much so that we can get away with the 'good' setting. Wow, that caused every card on my app to speed up!

I think I would suggest to any future readers to stay away from setting the imageQuality to 'best' when developing for mobile. They simply cannot handle the graphics processing.

I will upload a sample file that allows you to play around with this phenomenon and try different resizeQualities.

Thank you Simon!

And thanks for your input Jacque.

-Will

Re: How to show an image on a card without delay [SOLVED]

Posted: Fri Dec 19, 2014 3:12 am
by William Jamieson
BTW @Simon

I am not getting the same answer dialogue error as you. The dialogue box only goes away when i press "OK" or i use the BackKey. I

Might be specific to your version of LC?

I just used 6.6.2 and haven't noticed it on 7.0.1 RC3 and 6.7.1

-Will