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

Mike1970

Well-Known Member
Licensed User
To reduce the layout animation duration, goto Designer and reduce the 400, maybe to 50 or even 0 and compare the results.

View attachment 114745

Also, Load your layout first, before you check for Update - then start Activity B
Ouh ok, you mean this. I always put it to 0. I hate the default animation 😂😂


Also, Load your layout first, before you check for Update - then start Activity B
It’s already like so. I check for updates in activity A, THEN when I finish I go to activity B
 

techknight

Well-Known Member
Licensed User
Based on your animations of the issues, sounds like a prime opportunity for B4XPages to me. I havent used it yet either, but for what I do, I dont need it.

I always use the one activity to do everything. I just load layouts into panels in hidden views and swap them around when necessary, and removeviews when im done with them. There are better ways I am sure, but thats how I do it.

Apps that require pages and pages of different views/stuff, B4XPages over AHViewPager would be ideal/better solution in that regard.

Thats just my 2 cents.
 

Mike1970

Well-Known Member
Licensed User
Based on your animations of the issues, sounds like a prime opportunity for B4XPages to me. I havent used it yet either, but for what I do, I dont need it.

I always use the one activity to do everything. I just load layouts into panels in hidden views and swap them around when necessary, and removeviews when im done with them. There are better ways I am sure, but thats how I do it.

Apps that require pages and pages of different views/stuff, B4XPages over AHViewPager would be ideal/better solution in that regard.

Thats just my 2 cents.
Thanks for you contribution 😊
 

Star-Dust

Expert
Licensed User
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.
however if you develope a Android app (not necessarily cross-platform) with B4Xpages you wouldn't have these problems.

I think you have to make an attempt to rewrite in b4xpages as suggested by @Erel, you can reuse almost all the code but use many activities today are not recommended compared to what was said in the past
 
Last edited:

Peter Simpson

Expert
Licensed User
Hello @Mike1970
I personally do get where you are coming from, there no way on this planet I would convert some of my project over to B4XPages simply because of the complexity of them (time is money), but these days I do always start all my new projects using B4XPages, it's just my default action and it help me to get used to the future of B4X IDE.

Anyway, looking at the gif above, you are obviously doing something drastically incorrectly as your activity shows, disappears and then reappears again. Mike that's not a B4A activity issue, that's a code flow issue. Are you using Sleep(x) anywhere you should not be doing so?

Btw the fact that you can clearly see version number 1.0.9 when you first load the activity then it disappears should start you looking in the right place, but I could be wrong.

I had this same issue about 3 years ago, the solution was simply to change the order around of one thing that I was doing.

If I were you I would place breakpoints in your code just as each bit of code is being activated and run your project until you can catch where and why your activity is doing what it is doing. What I see there is not too complicated and a man of your talents should easily be able to get those activities loading seamlessly without any long pauses or lags in between activities/layouts being loaded, especially if you are not loading any data from any databases, you do not need B4XPages to get that running smoothly at all.

But as you are
 

Mike1970

Well-Known Member
Licensed User
Hello @Mike1970
I personally do get where you are coming from, there no way on this planet I would convert some of my project over to B4XPages simply because of the complexity of them (time is money), but these days I do always start all my new projects using B4XPages, it's just my default action and it help me to get used to the future of B4X IDE.

Anyway, looking at the gif above, you are obviously doing something drastically incorrectly as your activity shows, disappears and then reappears again. Mike that's not a B4A activity issue, that's a code flow issue. Are you using Sleep(x) anywhere you should not be doing so?

Btw the fact that you can clearly see version number 1.0.9 when you first load the activity then it disappears should start you looking in the right place, but I could be wrong.

I had this same issue about 3 years ago, the solution was simply to change the order around of one thing that I was doing.

If I were you I would place breakpoints in your code just as each bit of code is being activated and run your project until you can catch where and why your activity is doing what it is doing. What I see there is not too complicated and a man of your talents should easily be able to get those activities loading seamlessly without any long pauses or lags in between activities/layouts being loaded, especially if you are not loading any data from any databases, you do not need B4XPages to get that running smoothly at all.

But as you are
Thank for your time anwering, actually i think i found the reason of the restarting of the app "Glitch 1". Before go to the home page, i did "Activity.Finish" in main. MAYBE (i dont really know) the Main Activity must be never Finished, so the OS is noticing that is not initialized and it reload it (?), is just a supposition.. i remove the "Activity.Finish" from main, and i hadled the KeyPressed event in Home to prevent the user to go back in the Splashscreen (main), and that problem has gone.


The glitch2, instead, is still there. I did not put any Sleep in strange places, for example, the activity shown in the gif has not Sleeps at all in the whole code... and also it does not load anything from database. it just add two element in the CLV with that two images (very lightweight images) when it creates.

However, now i'm rushing converting to B4XPages only the Android project, i really want to see if that solve this glitches that i always experienced, and now i want to see this problem go away for ever.
 

Peter Simpson

Expert
Licensed User
...
it just add two element in the CLV with that two images (very lightweight images) when it creates.
...
Is that all, well in that case everything should be running extremely smoothly with no glitches whatsoever, I've never ever had that issue, not with only two preloaded images.

...
However, now i'm rushing converting to B4XPages only the Android project, i really want to see if that solve this glitches that i always experienced, and now i want to see this problem go away for ever.
...
Well that's good then, that will definitely help you to learn B4XPages more quickly which I must say is a cinch to get to grips with. If you are sure that you're glitch can't be fixed using the default project then hopefully using B4XPages will fix your issues.

Don't forget to report back how you got on with your conversion to B4XPages...
 

Mike1970

Well-Known Member
Licensed User
Don't forget to report back how you got on with your conversion to B4XPages...
So, i finished converting the project (For android only) like @Erel, @aeric and many others suggested
I had to say that the mentioned glitches are gone (probably becasue b4xpages is no more based on Activities), BUT now there is one last thing (i hope)..
I disabled the default animation of b4xpages with:
B4X:
B4XPages.GetManager.TransitionAnimationDuration = 0
because it was not of my taste. Now the "problem" is that there is no animation at all 😂:
How can i introduce an animation between pages that work even if i navigate through them using the OS button (the back button of Android)?
 

aeric

Well-Known Member
Licensed User
So, i finished converting the project (For android only) like @Erel, @aeric and many others suggested
I had to say that the mentioned glitches are gone (probably becasue b4xpages is no more based on Activities), BUT now there is one last thing (i hope)..
I disabled the default animation of b4xpages with:
B4X:
B4XPages.GetManager.TransitionAnimationDuration = 0
because it was not of my taste. Now the "problem" is that there is no animation at all 😂:
How can i introduce an animation between pages that work even if i navigate through them using the OS button (the back button of Android)?
Please start a new question for B4XPages related. 😅

P/S: I hope you agree now that converting to B4XPages is not as scary as you thought.
 

Mike1970

Well-Known Member
Licensed User
P/S: I hope you agree now that converting to B4XPages is not as scary as you thought.
Uhm actually im not conviced yet... im looking at it as a new way to workaround the Android notorious problems/glitches and all that ugly stuff
But not as an unlimiting cross-platform development tool yet. I hope i'm wrong (for the future me 😂)
 
Top