I've changed in the Screen1 Initialize the call to the Pattern Screen and compiled your .aia into an .apk. Downloaded on my Lenovo pad, it works (or at least it doesn't crash even there isn't any BT device connected).
So the difference is that you use it with the Companion ? Else, what is your "Companion App" ?
The last post was not a solution (thats why its deleted), thanks @uskiara for taking the time to look. I'm still working off the fact, that its the three blocks causing it to crash. Tried building the app and running but still run into the issue, even when the initialise screen is set to the PatternScreen.
More specifically I find the crash occurs when running normally and you change from any screen to the PatternScreen, I'm investigating the possible cause being that a layout box within the PatternScreen layout which is made visible/invisible by a switch in a different "screen" (I'm using " " because it isn't a Screen according to MIT App its just a layout box that is made visible or invisible). I've also tried putting the main screen first and last in the procedure.
Still confusing me as they are defined as visible from the designer tab as default, (usually having them invisible makes the app crash...)
Write what steps need to be taken in your app to trigger the error, because when testing your project everything works fine for me.
I'm not sure if I separated the three troublesome blocks or not, in the app I sent you. I'll send you another but I think I'm hitting a wall here..
BT_Lights_5_Revived.aia (976.3 KB)
I set the initialise screen to the patternScreen in this version, I left out the three trouble blocks and yes the app opens into the pattern screen except the other screens clutter the screen aswell... if you click the BT or the gear icon, then the pattern button it crashes
I had a thought that was, if you set a layout to visible after it was already set as visible it would crash but that is disproved as my app can go between the settings and the BT connect "screen" with no issue @Patryk_F
Well I walked away from it, came back, deleted the troublesome blocks recreated them and it worked, nothing changed about the block, entirely the fact it was a fresh block, I'm speechless...
Maybe copy and pasting it had an impact, or the app was holding data, or the order of the blocks in the procedure, or the blocks expired, got stale and moulded? @MIT any clues
Because I typed this post went back to check on it and now it doesn't work
sorry not having been capable to help you. I've been out for a few days and I read only now your answer.
When you say "copy and paste" do you mean by means of the backpack ? It has happend to me that sometimes the backpack didn't work as expected. Have you tried to make a freshly new app from scratch (and not only to rewrite the "despicable" blocks) ?
So, took a break from the project and returned with the dis-hearting knowledge that I would have to revive the project by starting fresh. Started a new project and copied and pasted the designer component tree to the new project, pictured below, thank you @MIT for this feature!!! Made some simplifications aswell.
Started with a empty block screen, made a simple block programme, pictured below, that only switched between screens. unimportantSideNOTE, previously I ran into problems when emulating using the companion app, it crashed if the screens where set invisible by defaut via the display tab. Doesn't do it on this version so bonus
The error strikes when making 'Pattern_buttons' layout visible. This error is not due to the long click of the LED_Pattern button. I put the long click there to test/show that it is purely the action of making the Pattern_buttons layout visible which does indeed crash the app.
BT_Lights_CPR.aia (35.2 KB)
I've called it CPR as it feels like I'm resuscitating this back to life.
I'm at the end of my wit with this, so may have to re-jig the app to work around the bug.. any help is nice, and thanks for all the support.
I've tested your new .aia and it "works".
In other words: by pressing the LED_Pattern button nothing "strange" happens. Therefore I've set as invisible the Pattern_LED screen, I recompiled, and it works well: when I hit the button, the screen appears..
I've then changed your code as follows:
and it still works fine. My testing device is a Lenovo pad M8, Android 9.
(Have you tried to use another phone ?)
A normal click of the LED_Pattern button should produce.
The long click should display below.
It still crashes, even after adding the if condition. I am on Samsung Galaxy S10+, Android 12
as I said, my Lenovo pad is featuring Android 9 and it works as per your screenshots.
The condition I added was just to try a different behaviour of the app, so to see if, in a different situation, the app could crash.
A question arises: what do you mean for "the app crashes": a runtime error appears ? the app shuts down itself ? An Android message in shown ?
Or: have you tried with another phone ?
Yep, runtime error, in the previous post I've edited to show the phone type, most of my family is Apple
Edit not a runtime error!!
I've taken away the Pattern_buttons layout and its still crashing, a friend may have an android so will go from there. I have an itch its due to all the layout boxes taking up more screen space than available but surely it would allow you to scroll, does it scroll for you?
BT_Lights_CPR (1).aia (35.1 KB)
Show the runtime error here....
To find out more, use logcat
Sorry not a runtime error, the app straight up closes..
Downloaded most of the files, is this an extension of android studio?
To test the hypothesis that the order of hiding and exposing Arrangements might cause timing problems in sizing screen components, try this variant that hides all VAs before exposing the requested VA ...
BT_Lights_CPR1.aia (34.8 KB)
For good measure, I also removed
If this does not help, I would try replacing that table arrangement with nested arrangements of fixed percentage sizes.
Beautiful blocks @ABG, like the logic. Didn't completely solve the issue tho..
THANK YOU EVERYONE FOR THE HELP, YOU ARE ALL CHAMPIONS and I wish I could return the favour.
The next few troubleshooting steps are, I made all the ButtonPatterns1 - 7 invisible, ran the companion app and went 1 by 1 making them visible then re-freashed the screen, found it was the rainbow button which crashed the app, so I uploaded the picture started again (didn't fix the problem), then changed the shape of the rainbow button from rounded to default like the others I HAVE NO IDEA WHY IT WAS DIFFERENT or how I never noticed.... Solved...
Well that's it... Done... That was the cause of all the fuss and commotion, the bug has been SQUASHED!!!!!!!!!!!!!!!!!
Today I Learned that a button with an image background can't have rounded edges.(at least in my version) BT_Lights_CPR1 (2).aia (142.2 KB)
This is called a runtime error
Using logcat helps to find out the underlying issue
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.