Android Question Android ugly glitches (White screen before loading layout and more)

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi everyone, i'm completing an app, but i really wish to solve those problems that i always had in these years using B4A.

Glitch 1:
I'm in Activity "A", i press a button to go to Activity "B".
Before showing the Activity "B" layout there is this ugly white screen in between, and then the layout of Activity "B" loads suddenly...
whitescreen.gif


Glitch 2:
I've the app open on Activity "B" (the app start from Activity "Main"), and i press the HOME button, so the app goes in background.
So... why when i click the app icon on the home screen to open the app, the app show for a fraction the Activity "B", then restarts from the "Main" even if it was in background.. so it should only resume it.. not restarting.

(p.s. i use the "Main" as splashscreen where i check for updates etc.., then i start the second Activity ("B"), and do Activity.Finish in "Main", so the user can't go back to "Main" from the Activity "B" using the back button).
homescreen_background.gif


I hope there are solutions to this glitches.
It would look more professional in this case.

Thanks in advance
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I already made a project with b4xPages.. I had to change most of the code to get it working for Android and iOS.. because many thing are made in completely different way… so I did not find any advantage respect to copy/paste the project normally
Very big mistake. I created more than 30 projects, including very complex ones, and there is no better way to share code than with B4XPages.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
Very big mistake
I did not feel comfortable to worki with it... Given the fact that i would my apps to be more native-looking possibile i need to use the natives objects of each platform.
Examples.
  • In iOS i use the DatePicker with the wheels, in Andoird it exist? no, so i've to do it in a alternative way, manually, with some library, or change the logic it self
  • I need the Speech Recongition. In iOS it is native, and work in a way, in Android i need to use external library to do it and works in another way, so.. to do the same task i had to change the code logic to get working on both.. so it means, do the code, and b4xpages does not help
  • in iOS to achieve some graphical results i have to do through ObjectiveC, in Android that thing maybe is even not necessary to do
  • Firebase Notifications. Works in two different way. In Android for example is needed a service, concept that in iOS does not exists. (i don't think that this thing is made automatically when writing for one)
  • Using QRcodes.. samething of SpeechRecognition
  • Handling the keyboard (different values are returned because different logic, one refers to the keyboard height, the other refers to the activity height)
  • Perform an Haptic Feedback
  • and so many other cases....
For this type of situation how B4XPages is supposed to work? will it just convert all this thing automatically or i have to code this parts depending on the platform?
Because in that case i will surely try it again for the next project.

Maybe it solves some Android UI glitches, i did not tried it with this in mind. If is this the case, i can consider to use it only for this purpose.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
There is no relation between B4XPages

Because you said...
better way to share code
In those cases how can the code be shared between B4A and B4i..?

------------------

However... i think we went a bit out of topic.
I can't convert the whole project to B4XPages now only to see IF the white page is removed, unfortunately :(
I compressed all my graphical resources, as suggested by mcqueccu, i will update the post in the case it improves
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4XPages doesn't force you to write only cross platform code. You can have platform specific classes and you can use conditional compilation when needed.

I don't want to argue with you. If you think that it is easier to build cross platform projects without B4XPages then clearly you missed something and need to learn more about B4XPages.
Example of a real and complex app where 99% of the code is shared between B4A and B4i: https://www.b4x.com/android/forum/t...t-for-mastodon-pleroma-social-networks.124214

BTW, you are saying Android gliches but I don't see any glitch. Everything you described is expected. It can be "fixed" or improved in all kinds of ways but you should first learn how to use B4XPages.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
I don't want to argue with you.
do not even mention it, it's just a healthy discussion :) . Nothing more :D


Example of a real and complex app where 99% of the code is shared between B4A and B4i: https://www.b4x.com/android/forum/t...t-for-mastodon-pleroma-social-networks.124214
Ok thanks Erel, i will try again when starting a new project. for me is quite impossibile now start over to do it in b4xpages.


Android gliches
I mean the fact that going from one activity to another, before the layout of the target activity loads there is that ugly whitescreen right before.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I mean the fact that going from one activity to another, before the layout of the target activity loads there is that ugly whitescreen right before.
First step is to make the default Activity color match your app colors. It is done with android:windowBackground.

If it takes too long for your layout to load then you should split your layout file into several files and load them when needed.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
First step is to make the default Activity color match your app colors. It is done with android:windowBackground.

If it takes too long for your layout to load then you should split your layout file into several files and load them when needed.

Uhm i don't know if is this the case.. becase as you can see, going from the Homepage with the three colored buttons to the one with the two green rectangles there is that white gap i wish to remove. The target Activity has not a solid color as background, but an image.
And also, the second activity is composed of:
  1. a label as title
  2. a label as backbutton
  3. a clv
  4. image as background
i don't think is this much to cause that slow loading :(
Maybe i can load the clv with LazyLoading.. i did't before because it will contain max 2-3 elements, so... can be this the problem? (even if this happend also with other activities where i used it) :(
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Uhm i don't know if is this the case.. becase as you can see, going from the Homepage with the three colored buttons to the one with the two green rectangles there is that white gap i wish to remove. The target Activity has not a solid color as background, but an image.
How can you know if you don't try?
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
what do you mean?

To reduce the layout animation duration, goto Designer and reduce the 400, maybe to 50 or even 0 and compare the results.

vd.PNG


Also, Load your layout first, before you check for Update - then start Activity B
 
Upvote 0
Top