Slow load layout etc.

bluedude

Well-Known Member
Licensed User
Longtime User
Hi,

I notice all the time when loading my app. that it first shows the title bar with a black screen. The title is the app. title.

It seems to take a while before the layout gets loaded and shown, especially on slower devices.

In every app. this is the case, even the tiny ones. Is there a way to make the loading process more slick?

Tried adding a loading dialog etc. in Activity create but no luck. I guess this is how B4A does the loading process.

Any suggestions?
 

bluedude

Well-Known Member
Licensed User
Longtime User
Erel,

Not sure if this is what I mean. I noticed with every app. (even with tiny layouts) it always first shows a blank screen and a title bar. Depending on how big the app. is this displays less than a second or between 1-3 seconds.

Would a way to change this be to use Addview in Activity_Create first?

On slower devices you have to look at this screen for a while. Even the smallest app. (with nothing in it) displays it.

Cheers,
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
erel what would be the correct code to show
this "loading..." label for slower devices?


B4X:
label1.Initialize("label1")
label1.Text="Loading..."
activity.AddView(label1,0,0,Activity.Width,activity.Height)
DoEvents()
label1.Invalidate
activity.Invalidate
DoEvents()
DoEvents()
activity.LoadLayout("big")
DoEvents()
label1.Visible=False
activity.Invalidate
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
Erel,

I bet it isn't going to solve the problem but i'm going to try. I think it is how an app. is initiated (grey titlebar with app. name and black screen).

Anyway, going to try.
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
Tested it and as expected still the same "problem". Before Activity_Create the app. always first shows Grey titlebar and black screen.

Going to test if this is the case with a real native app.
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
Anyway, tested it and even with Loading Dialog it always shows title bar (with app name) and black screen first. Not sure if this can be changed? Erel?

Why are other Android apps. (non B4A) I see not doing this?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Activity_Create is called after the screen is drawn for the first time. The available width and height are not available before. This causes a delay of a few milliseconds.
It allows you to build the layout based on the currently available size.

Are you testing your application on the emulator?
It is barely noticed on a real device.
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
Erel,

Not saying it is a big issue but I notice it and sometimes it is a little longer. Does this have something to do with B4A?

Not on emulator, real devices (Nexus one and Hero). The second device is slow.

Anyway, going to see if I can use the Loading dialog stuff.
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
Erel, is there a way you could change the startup then? Probably just a black screen would be more aesthetic.

Cheers,
 
Upvote 0

latcc

Banned
I am a beginner but could you have a tiny startup program apk that shows the splash screen and then loads (calls) the main apk? Can B4A do that? It would be similar to chaining exes. At least then you would get a splash page up and could put up a 'please wait...' message while the long-winded black 'nothing-happening' page exists.
 
Upvote 0

joseanquiles

Member
Licensed User
Longtime User
Hello,
I am a newcomer with B4A and likely I'm going to say an obvious suggestion, but I had a similar problem at the beginning: I had checked "Attach Debugger" option in Project menu and applications launch was slow. I unchecked this option and everything was fine.
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
Erel,

Tested it several times on many different devices and it isn't fast on all devices, unfortunately. I wish the initialization screen looked different. With some apps. my old Hero stays 1-2 seconds in the titlebar and black screen.

Cheers,
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
Bluedude, what's up with the project you are testing with?
Does this happen with a bare bones blank project too?
Is the project you are talking about big?
We are blindly giving you answers to your problem here.
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
Well, If you have seen my forum messages I talk about bare bones, small, big etc.

I assume everybody notices it because I'm not doing anything weird. My problem is that I think it is ugly if it takes too long.

Anyway, it isn't showstopper and maybe i'm the only one having this visual issue after all :) Could be that my eye for small details is spoiling my fun.

Just to make sure, B4A is awesome and I already use it for a long time. Just as I used B4PPC for a long time.

Cheers,
 
Upvote 0
Top