RemMe memories and development considerations and code
Let me be clear from the outset: I will not teach anything (I would not be able) but only summarize some of the choices made during the development of the Android version of Remme.
When i wrote "this is my first program for Android" it was really so but, to tell the truth, Remme was born back in 2002 (
as RM2002 see at www.efsoft.it/test.htm) developed on a PC with Visual Basic.
Subsequently I made it a standalone program for use on winCE PDA even in the absence of connection to the PC.
Those first versions were able also handle an archive of images working as a viewer.
When I found out B4A and the opportunity to use the old Basic (in a much more powerfull way) on Android, the choice Remme as first project was automatic:
Under Android he problems, however, are a little differents.
Owing to my habit of creating programs by mono window that change appearance depending on the required features i need create very crowded layouts.
On old PDA using the stylus was not a problem select objects also too much near but the "Touch" requires that each sensitive area is accessible from several types of fingers, on several different screens and without errors.
Thus, the interface needs to be rethought for this and other needs.
If you see the Layout image of the Designer posted below you will note that includes many objects (some of which are also not visible).
But you can see that the objects on the high zone of the screen are disposed in 3 separate lines in order to be used without interfere.
You can also note that into this 3 lines there are the main buttons and instructions about the use of the program and for the function selected by the user.
The position of the main buttons allows to avoid to scroll the visible screen up when you need to use the android keyboard. The only button that will be covered by the keyboard is the button Exit but, if you required the keyboard, is quite sure that you do not want to exit from the program.
The second choice that makes the above mentioned solution more functional is the duplication in that zone of the data you need along with a window to show the instruction to use the current function.
For the old RemMe developed for the Windows world (Mobile or not) was common use to create an Help file to instruct the user.
Obviously this is not something of impossible with Android but considering the S.O. the best for mobile devices it may be not convenient to search, open and read a file or an help text, so was born the idea to drive the application's use showing to the user the next instruction.
Also this Help's lines are shown in the upper part of the program's screen to maintain them visible while you are using the keyboard.
These directives may be also not considered a correct way to operate.
I can only say that i followed the above mentioned considerations and for this reason the interface of RemMe is the one you can see now.
Following the above it is therefore necessary to create command bars that can handle the multiple functions of archive/records management.
The first of these, and even the most simple is the bar with the arrow.
The arrow inserted in the bar is the real control of the bar that pilots the choice/reading of Archive and Records and at the same time the reverse operation.
To the left is the label that shows the name of the archive chosen, while the label at the right of the arrow usually shows step by step instructions.
The second command bar is far more complex because it brings together two pop-up menus used in an asynchronous (ie the use of one inhibits the other). In addition, the first menu items are direct commands to specific functions (record addition or change settings) that initiate and direct functions not related to the use of the menu within which they appear.
It should also be noted that the text of many labels (that is modified during use) is not just a simple piece of information visible to the user but also represents a flag that informs the code in use for the current action or to perform other code. In total this second bar drives 8 different functions of management Archives / Records.
The code used is quite easy. based essentially on
IF/THEN/ELSE with the particularity to modify label text during the use so that the label works as a swith OPEN/CLOSE.
I posted in a previous message above few code lines as sample.
Equally simple is the code to have an immediate translation of the program in different languages.
In this case i made some search to look at the solutions used but, may be that i did not understand the informations i found, i thought that my program, specifically wished minimal, was not the correct application to receive a complex translation system.
So i came back to the use of common Basic elements.
I created 2 bidimensional matrixes , [
A(5,12) and
B(5,100) for example] declared as Global variables.
A third global variable
S (as search) is the one that will be used in the code to call the instructions or text of labels
(B) and the names of the records and archives
(A).
All the text strings are memorized directly into the program using a Code Module (
CodeM) to call to use the text required. See the sample:
......................
B(1,3) = "Repeat"
B(1,4) = "WRONG entry - Retry"
B(1,5) = "Register"
B(1,6) = "Registered. Archive started"
B(1,7) = "Archives are not initialized. "& CRLF &" Type the password again and press Repeat."
......................
The following instead is the code created in the Activity
in the "Sub Activity_Create (FirstTime As Boolean)" of the main form is inserted the code that reads from the archive the variable S that determines the current Language
(Example
S = 1)
In this and others activities of the program all texts are replaced by the following type of code:
........
Lbl.Text = CodeM.B (S, 3)
.......
that, if S is as in the above example gives to the Lbl the text
"Repeat"
Likewise, if S was 3, instead of 1, the text would be
"Repetir" (Spanish), etc.
to summarize
:
Code Module
B (0, 0) = "SI" -----> if S=0 Italian
B (0, 1) = "NO"
etc.........
B (1, 0) = "YES" ----> if S=1 English-------> Label.Text = B ( S, 0 )
B (1, 1) = "NO" -----> if S=1 English-------> Button.Text = B ( S, 1 )
etc.........
B (2, 0) = "OUI" ----> if S=2 French
B(2, 1) = "NO"
etc.........
I am not able to assess the efficiency of the system in absolute terms, but I think it is valid for the translation of texts of reduced number of elements and languages
This System allowed to select the language when you install RemMe the first time. I added the possibility also to changeb language on a second time but there is still a problem.
As the elements of the archives are integral part of the program's code i can memorize the change of the archives names and titles made by the user but not to repeat the same in the code, So when i change the language on the fly I am allowed only to reload the archive of default elements loosing so the changes made and the sinchronizations of titles and fieds modified.
This is the next problem to solve along with a better translation for the languages that i do non know (i used Google translation but ........)
Sorry for a so long text but i hope that it may help somebody to solve some problem. Thanks to all.