Any tips to avoid too many blocks within Screen Initialize Event?

I was not talking about people who actually tried to help me. :sweat_smile:

This logic looks interesting. I may have to try this one last time. Lol :joy:

I have redesigned my app several times over the last couple years, including redoing it completely from scratch when I migrated from Appybuilder. I know it can be frustrating. if this is something that you want to do, the effort will be worth it. I had issues with Firebase Authentication earlier this year and it took WEEKS to finally find the right person in the community that had the solution to my issue. Keep at it, you’ll figure it out.

1 Like

There’s a problem with this approach. We cant put decimal values in designer na ?:sweat:

For a percentage? Why do you need decimals? From the video earlier I saw 2 columns, I would set each at 25% or whatever works for the design and then set height equal to width using a loop.

Else I will have to redesign everything.
I set everything according to screen width. Even the corner radius, padding & spaces too.

Another workaround would be to hide everything until it’s done. Simple and effective. Create one layout with a splash image as visible (or animate it in) and set a timer to run at initialization for 3 seconds or however long that will hide the background processes. Put everything else in a separate layout with visibility turned off. then while everything loads in the background you just have the splash image twirling or something. then when the timer runs out (or just when the page layout is loaded correctly) use Phase or Animation Utility to transition from one to the other.

I do something similar while I check for an internet connection, log my users into Firebase, and pull user ID from OneSignal.

That will anyway create issues in my case. Casuse this is the main screen. (This is a 2 Screen app where the first screen is my splash screen & everything else is on screen 2 or main screen)

So you have 3 screens? Screen1 (splash screen), Main screen, and screen 2? Hiding everything while it loads still seems like a valid option. You just have to get creative with it. For example, my app does the same thing. I have screen 1 as my splash and then load the home screen. I have everything off to begin with and then set it visible before animating the screen sliding in from the top. That way I know everything is going to look correct when it loads in.

No. Just 2 screens. ‘Screen 2’ is my ‘main screen
If you don’t mind can you show me a screen record (video/gif) of what you actually meant ? :slightly_smiling_face:

the general solution is the following (as already mentioned in the App Inventor community)

use a clock component, set timer enabled to false and timer interval to 100
move your blocks from Screen.Initialize into the Clock.TImer event
as first block in that event set timer enabled to false

and in Screen.Initialize only have one block:
set Clock.TimerEnabled to true

Taifun

2 Likes

But it didnt work for me :face_with_head_bandage:

Just out of curiosity could this be due to the number and size of images you are using. In my recent app I had a similar slow start to my app, then after resizing my images and making them smaller, the loading times drastically lowered and the app loaded almost instantly. Then after that I used a image size reducer which reduced image sizes by 70%, again making it much quicker.

1 Like

No. I have very few images only.

1 Like

you forgot to share a screenshot of your relevant blocks…
Taifun

1 Like


blocks (4)



blocks (3)

You can add my Moto E5 Plus to that no issues list. My resolution is 1,440x720 and I’m an 18:6 ratio at ~268 ppi density. I’m running android 8.0.

I forgot to add the Android version. I doubt if it has anything to do with it too.

Yea, I know android version messed with me, but that’s because I was trying to grab device ID (our app is used on company devices) and the newest updates to some of them wouldn’t allow it, Android doesn’t allow you to pull IMEI numbers anymore.

1 Like

Your testing list is weird. My moto E5 Plus has worse specs than the Nokia 6.1 Plus. that phone shouldn’t have any issues if it’s just the math.