I am trying to write a sub with many lines of code but when i complile, b4a gives me this error message if my code lines are more than 2959 in this sub.
Compiling generated Java Code. Error
Javac 1,0,0_13
src\b4a\example\main.java:325: error: code too large for try statement
try {
^
1 error
when I change the compilation method from Debug to Release it allows more lines of code in one sub but gives me the following similar error message after line 10922.
Compiling generated Java Code. Error
Javac 1,0.0_13
src\b4a\example\main.java:33155:error: code too large for try statement
catch (Exeption e) {
^
1 error
In these line codes i set lots of values. So i will breake my code to smaller subs.
So, there is a limit of the lines of code in one sub. What is that limit? Are there any other limitations? The number of subs in an activity, or the total number of lines in an activity or in a process?
Is there a place where I could find those limits of Java?
If you write each variable to a line, then you should try setting multiple variables in each line. This can be easily done by using excel or something like this. Still, you can create subs and call them from inside your try-catch block, no matter how big the arrays are. Furthermore, why not getting the data from a file? You can even use encryption if you worry for data's safety.
As mc73 already suggested: Furthermore, why not getting the data from a file? This should be your solution ! You could write a small program to generate these files.
I remember having read somewhere that a Sub should not exead something about 20 lines to keep an overlook.
And I agree with this !
If you write each variable to a line, then you should try setting multiple variables in each line. This can be easily done by using excel or something like this. Still, you can create subs and call them from inside your try-catch block, no matter how big the arrays are. Furthermore, why not getting the data from a file? You can even use encryption if you worry for data's safety.
I do - in fact I have converted several old Basic programs (written in GWBasic) to B4A and dealing with the old DATA and READ statements was sometimes a real challenge as is creating an alternative to GoTo (Case statements work well for this).