Basic4android v2.00 is released!

Erel

B4X founder
Staff member
Licensed User
Longtime User
Basic4android v2.00 is now available. This upgrade is probably the most significant upgrade since v1.00.

The major new feature is support for class modules. With support for classes Basic4android now allows you to write both procedural code and object oriented code.
Object oriented code makes it easier to write and maintain large projects.

Basic4android v2.00 improvements:

- Classes

- Public and Private access modifiers

- Built-in documentation

- Better handling of tasks in the internal thread pool

- CallSubDelayed keywords - These keywords significantly simplify the interaction between services and activities.

- Building process improved and it now supports libraries with embedded resources (such as PayPal, Zooz, Samsung Pen and others).

- Bug fixes and other minor improvements.

Note that B4A.xml was modified in this version. The highlighting styles section was not modified.
The Reflection library was updated to support the new version internal changes.

V2.02 is now available. You should use the same link as the link to v2.00.
This version fixes several issues related to CallSub and CallSubDelayed keywords.
 

margret

Well-Known Member
Licensed User
Longtime User
OK. I went back and tested and version 2.0 does give the error you listed above.

I use the 0 + MyEdit.Text in a sub in a code module and it seems to work fine there just not in the CallSub.

The way the CallSub works seems to be the difference I spoke about above between 2.0 and 2.02. When my app first loads, a function is called in a code module, which in turn uses a CallSub to call a sub in the main activity. In 2.0 this works fine when the app first loads. It also seems to work fine in 2.02 but not when the app loads the first time. It's like the CallSub does call the sub in the Main Activity the first time. It does however, work each time after the first load of the app.

Any idea?

I wish I knew just a little of what you know agraham!!

Thanks for any help or explanations.

Margret
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
Longtime User
I use the 0 + MyEdit.Text in a lot of code
I don't see why you would need that.
it works but it is subs in a code module not the CallSub.
Exactly. As it is a direct compiled call the compiler can do the coercion if necessary as it knows the types of the parameters.

It's like the CallSub does not happen the first time. It does however, work each time after the first load of the app.

Any idea?
Look in the filtered log to see if there is an "ignoring event: " entry. If it is in Activity_Resume I would have expected it to work but without seeing the actual structure of your code I am guessing.
 
Last edited:
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
Hello agraham,

Here is the code in the Activity:

B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("DataSampledb2")
   Activity.AddMenuItem("Start Activity", "another")
   If db.Exist(db.FilePath_ & db.FileName_) Then
      db.FirstRecord
   Else
      SetupNewDB
   End If   
End Sub

Here is the class sub called from Activity:

B4X:
Sub FirstRecord
   If Exist(FilePath & FileName) Then
      Dim FileData As List
       FileData = File.ReadList(FilePath, FileName)
      RecordCount = FileData.Size
      If FileData.Size > 0 Then
         Pointer = 0
         UpdatePointers
         GetRecord
      End If
   Else
      Msgbox("File Not Found Or No Records", "NOTICE")
   End If
End Sub

Here is the class sub called by the FirstRecord class sub:

B4X:
Sub GetRecord
   If Exist(FilePath & FileName) Then
      Dim FileData As List
       FileData = File.ReadList(FilePath, FileName)
      RecordCount = FileData.Size
      If FileData.Size < 1 Then
         FileData.Clear
         Return
      End If
      If Pointer > -1 AND Pointer <= RecordCount -1 Then
         Dim AF As String
         AF = FileData.Get(Pointer)
         Dim af2(N_Of_F(WorkArea)) As String
         af2 = Regex.Split(SC, AF)
         For l = 0 To N_Of_F(WorkArea)
            If (af2.Length -1) > = l Then
               Field(l) = af2(l)
               If Left(FieldN(l),1) = ">" Then
                  Field(l) = Field(l).Replace(Chr(245), CRLF)
               End If
            Else
               Field(l) = ""
            End If   
         Next
         FileData.Clear
         UpdatePointers
         CallSub(Main, "GetFields_" & WorkArea) 'Does not work in 2.02 first time works in 2.0
      End If
   Else
      Msgbox("File Not Found Or No Records", "NOTICE")
      CallSub(Main, "ClearFields_" & WorkArea)
   End If
End Sub

Here is the sub of the Main Activity:

B4X:
Sub GetFields_0   
   name.Text    = db.GetField("name") 
   address.Text = db.GetField("address")
   city.Text    = db.GetField("city") 
   state.Text   = db.GetField("state") 
   zip.Text     = db.GetField("zip") 
   Phone.Text   = db.GetField("phone") 
   CurrentView   
End Sub
 
Last edited:
Upvote 0

jaminben

Member
Licensed User
Longtime User
Hi,

I have a strange problem using the HttpUtils2 where I get an error when using my device over my mobile data network but I never get the error when my device is connected via a wi-fi connection.

The error seems to come from the HttpJob module and its:

B4X:
httpjob_getbitmap (B4A line: 122)

b = LoadBitmap(HttpUtils2Service.TempFolder, taskId)

java.lang.RuntimeException: Error loading bitmap.
   at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize2(CanvasWrapper.java:500)
   at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:491)
   at anywheresoftware.b4a.keywords.Common.LoadBitmap(Common.java:1024)
   at com.jaminben.mediamanager.httpjob._getbitmap(httpjob.java:199)
   at com.jaminben.mediamanager.moviemediadetails._jobdone(moviemediadetails.java:1562)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
   at anywheresoftware.b4a.keywords.Common$4.run(Common.java:881)
   at android.os.Handler.handleCallback(Handler.java:605)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4514)


   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
   at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Error loading bitmap.

Not sure if its my dodgy coding thats causing the issue or something else... anyone else seen anything like this?

Thanks

Ben
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
@Agraham

Below is the information from the test you ask me to do:

I re-tested the code both in version 2.0 and then 2.02. Again 2.0 does work and the GetFields sub in the Main Activity does get called.

In 2.02 it does not get called. Even steping through in the debugger one line at a time, it gets to the CallSub() but just skips over it. In the unfiltered logs, I do see an Ignoring Event: GetFields.

So, why does 2.0 run this code but the CallSub gets Ignored in 2.02?

Thanks for any help!
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
Longtime User
So, why does 2.0 run this code but the CallSub gets Ignored in 2.02?
I don't know, I would have expected 2.0 to ignore it as well if it was called in the scope of Activity_Create. I would expect it to work OK if you move it to Activity_Resume. If it doesn't then Erel would need to explain it.
 
Upvote 0

jimmyjace

Member
Licensed User
Longtime User
Basic4Android v2.02 - Compile Errors

Hi all,

I've just upgraded to the latest release and when I compile my previously working code i get the following:

Compiling code. 0.08
Compiling layouts code. 0.00
Generating R file. 0.00
Compiling generated Java code. Error
javac 1.6.0_33
src\com\ild\mobile\main.java:54: cannot find symbol
symbol : variable sharedProcessBA
location: class anywheresoftware.b4a.BA
processBA.sharedProcessBA.activityBA = null;
^
1 error

I took Erel's advice and checked the Additional libraries path, but nothing is set there. I also did a "dir bashared.jar /s/p" on my c: drive and only found one instance in the anywhere software\basic4android\libraries folder.

It doesn't compile with either javac.exe from JDK 1.6 or 1.7.

Is there anything else I should be checking?

Cheers,

Jason
 
Upvote 0

itbank

New Member
Licensed User
Longtime User
Wher can i download new version?

Where can i download new version? I didnt got update link :/

 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
How to download? When i bought the earlier version, it said free updates but no explanation how to obtain it? Only link I have is for the ver19 folder
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…