When I press the a button to go to another screen my app just freezes and eventually crashes, any way to debug this

When I press the a button to go to another screen my app just freezes and eventually crashes, any way to debug this(still only happens on the apk but not the companion)?

1 Like

Yes, it's probably due how the companion handles the memory vs how the apk does.
Please be aware that when switching between screens many troubles can arise, such the loss of BT communication, the loss of "global" variables, and many others.
To avoid that, we usually suggest to use virtual screen instead. If you dig the forum with such a tag (virtual screens) you'll find a huge amount of material on that. In a nuthshell the hint is to use Horizontal and Vertical layouts visible/invisible to behave like they were complete screens. In that way you'll have only one screen (screen1) and all problems, those I mentioned before, disappear. If your app isn't too much complicated to reduce it into a unique screen, please give it a try.

Cheers.

most of my screen has lots of blocks though, and bundling them to virtual screens would make it complicated though?

I'm afraid yes, but it's not a matter of how many blocks per screen but how many User Interface components (labels/buttons/canvases/layouts, etc.) have you spread across them.
Let's then try to continue with multiple screens: do you have a BT communication active ? Do you exchange variables between them ?
If yes, please be aware that they will not work and probably they'll crash the app (or you'll get get it stuck).
If this does not solve, please open another post with a new title, attaching the .aia, so also other PU's can have a look to it and help you as well.
Best wishes.

some screen use compcreator and some are just simple screens with buttons(im tryin g to merge the simpler scenes together) no BT

You do not share with us HOW you switch screens. Here are several ways you might switch screens properly (if you are not doing it already).

Actually there are five or more acceptable methods shown in the thread.

Why is how you do this important? Because part of your issue might be how you may be misusing real screen use.

Some of the code in individual screens may be using excessive memory. If you share images of some of your code. Developers here may point out possible issues. Sorry, can't do that without you exposing some code. :wink:

3 Likes

sorry, i switch screens just by using the
Open another screen block, which i realized was a bad idea just now(i didnt read the block name a lot and didnt see the another) part, ill check out those methods, thanks!

1 Like

thank you! this is a lifesaver, i went with tribblehunter's approach since im in a rush to finish this project and cant afford big revisions.