Fellows App Inventors,
I am currently developing a relatively complex, multi-screen application (the blocks of one screen need 2 lateral and 7 vertical scrolls at maximum zoom out to cover all the events and procedures, and I have 6 screens with user interface widgets already, so I suppose it qualifies as pretty complex). One of the capability I want to build-in is support for multiple languages, where all the button captions, labels and dialogues are housed in language-coded files (which could even be supplemented by users), one of which is read as a function of the user-selected language, copied in TinyDB, and then accessed by all the relevant screen and used to set up all the relevant text bits through a series of statements in the various screens "Initialize" event.
In order to streamline processing, the actual reading of the language file and the loading of the TinyDB record is done by an auxiliary "shadow" screen, which is opened when the application initializes for the first time, and again should the user select a different language from the currently defined one (through a list picker .AfterPicking event), which is supposed to then override the TinyDB record with the different language captions. That screen is supposed to "close screen with value" at the end of the reading and loading into TinyDB, and hopefully return control to the screen that did the calling, where it should trigger the appropriate ".OtherScreenClosed" event, which will then call whatever procedure to update all the relevant captions and labels in the alternate language using the copy passed through the TinyDB tag.
Except that it doesn't.
When launching the application for the first time, it starts with Screen1, as expected, which then checks if there is an appropriate "loaded language" tag in TinyDB and upon not finding one, calls the language read routine to load the default English file. That screen is supposed to complete the reading and return to Screen1, but all I get after waiting an inordinate amount of time is a blank emulator screen, while the web browser development page in "http://ai2.appinventor.mit.edu/
" switches back to the Screen1 block page, indicating that the file reading screen is supposed to be finished with its processing and closing... but somehow the Screen1.OtherScreenClosed event is not triggered.
Not seeing where this comes from, I peppered the code with progress caption markers at the start and end of most concerned procedures and event blocks, directed to a log file that I can visit thereafter. And I do have the proper sequence of
- "Screen1 calls language reading screen" (that statement is placed just ahead of the "open other screen" call)
- "Language reading screen initiate" (at the head of the Initialize block) and the
- "Language reading screen about to return" (at the end of the .GotText block that loaded all into the TinyDB)
being issued, but the expected Screen1.Initialize that ought to follow the return, let alone the message at the start of the Screen1.OtherScreenClosed event block, never comes. And I have waited something like 15 minutes before stopping the emulator and running my "message log file visit" application (where on Earth is /sdcard anyway? I tried searching for the filename across all directories, and can only conclude that this directory is hidden or somehow "encoded". Having to rely on a custom application just to look at the content of the log file is some kind of an additional annoyance).
What is stalling the code?
Are there some additional, little known and poorly documented limitations in the emulator, or in App Inventor 2 itself, like a maximum number of pending processes, that I am unaware of?
For the record, the "aia" file is 648 KB. Even taking all the other files that are supposed to be part of the installation into account (images, data files, icon, etc) brings the total memory requirement to 1.23 MB, far from the limit, as far as I can understand.
I have been at it for over a week already, and not showing any progress; and now, on top of it all, I am out of ideas what to try next.
So, does anyone have anything to suggest?
Any help would be much appreciated.