Virtual Screens / URSAI2Sidebar - App Opens for a Second And Closes

Hello,
I am working on an Android app, which has Screen 1 plus 10 virtual screens on Screen1 and I use the URSAISidebar. Yesterday, I had many problems with AI, because the arrangements did not change to visible = false, when I clicked off in designer. But this is not the problem.

The problem is, if I will install the app for testing on my tablet, it installs, Screen 1 opens for a second and after this, the app closes and goes back to Google Drive, where I upload the app for installation.

It is a huge code, and so I had to post all the blocks in the image, because I do not know where the mistake is. I also use 10 CloudDBs. Also I do not know, if I have ten screens with diaries (every of the 10 cats has a profile page (virtual screen), where the user can enter the name of the cat and can make a diary entry about the learning success of his cat. And do not know if I need only 1 CloudDB for it or if I need 10 CloudDB? Could someone, please, help? Mainly, the problem with the closing of the app be solved, if possible. Thank you very much in advance. Have a great Monday! Martina

  1. You only need one cloudDB. Plan your data structure to enable this.
  2. Make a procedure for switching virtual screens (hide all then show the one you want)
  3. Make a procedure for the sidebar to handle click selections, to go with 2 above

This will massively reduce your blocks, and the complexity of your app.

As for why the app crashes ?

I suggest start with a simple test project, perhaps 3 virtual screens,which will make it easier to test an debug.

Dear TIMAI2, Thank you for your help. I will try it. The problem with the procedure is, that there in the ListPicker are 10 cat profiles "Samtpfote 1-10" and if one of the profiles is selected, the screen1 (there is also the listpicker) and the other virtual cat profile screens should vanish (false). Only the selected should not be false. I have never let depend the visibility of the screens on a listpicker selection, I do not know if it works in this way. In every case, I will try your solution now, if I am able to do so. If not, so I will come back to this entry. Thank you very much! Have a great day! Martina

This point I do not understand. The sidebar worked perfectly, the screens opened how they should. I only deactivated some parts of the sidebar code, because I have thought, that this code was the reason, why the app crashed. I do not know, why it is crashing. Perhaps also because of the huge amount of DBs, which I had. I have changed it to 1 TinyDB and 1 CloudDB. But problem, I think, was, that on the home screen on Screen1 the visibilty was set to false, because I would like to have only the cat's profile visible after selecting from the ListPicker. After I had delete this code, so that the Home Screen and on the botton the cat'*s profile did appear, the app did not crash anymore. There is something wrong with the HomeScreenArrangement visible false after choosing cat's profile 1 with the ListPicker.

Here are my codes now:

Here is an example of how you might proceed

exampleVSselector.aia (160.9 KB)

Oh! Thank you very much. I will have a look at it. I will answer soon again. Thank so much! Martina

The app does not crash anymore and the cat's profiles are visible, but still is there a lot to do, because my URSAI2Sidebar does not work. I will proceed with coding, I have now a look at your aia. Thank you very much! Martina

Update for URSAI2Sidebar: Sidebar works again. Sidebar - show was accidentally deleted before, now again integrated – and it works! Hurray! Thank you! Now I proceed with TIMAI2 suggestion/aia to switch from the cat's profile screens. I hope I am able to do so. Thank you!

Hello,

Thank you again.

Update:

The sidebar works perfectly, no need to change.

I used your switch.aia for to switch the cat's profile virtual screen, but I got an error of Android like the following:

Select list item: List index too large

Select list item: Attempt to get item number of 10 of a list length of 2: [VA1].com.google.appinventor.components.runtime.VerticalArrangement@2be65cd

How can I change the code to avoid this error? I have a list with 11 arrangement, which should be visible or not (1 Home screen [Screen1], 10 cat's profile virtual screens).

Does someone please know a solution? Thank you very much in advance!

Martina

Here are the blogs:

image

should be index = 2

like my example

If your block or component counts increase with the number of cats, you are doing it wrong.