Basic4android v2.00 is released!

Erel

Administrator
Staff member
Licensed 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.
 

stevel05

Expert
Licensed User
Great job Erel, from someone that had very little knowledge of classes and oop I thought that it may be a nice feature.

Having had the chance to play with it for a while, I'm wondering how we managed without it.

It makes a great product even better!

I might even be able to tame my spaghetti code :)
 
Last edited:

billmoultrie

Member
Licensed User
B4A Ver 2.00 problem

Just downloaded and now find all my apps, have the following problem when I compile.

B4X:
Compiling code.                         0.48
Compiling layouts code.                 0.02
Generating R file.                      0.00
Compiling generated Java code.          Error
javac 1.6.0_29
src\anywheresoftware\b4a\popping\main.java:54: cannot find symbol
symbol  : variable sharedProcessBA
location: class anywheresoftware.b4a.BA
        processBA.sharedProcessBA.activityBA = null;
                 ^
1 error
 

Hennell

Member
Licensed User
Awesome

>The major new feature is support for class modules.

There is no emoticon for my excitement at this announcement!
 

salmander

Active Member
Licensed User
Just downloaded and now find all my apps, have the following problem when I compile.

B4X:
Compiling code.                         0.48
Compiling layouts code.                 0.02
Generating R file.                      0.00
Compiling generated Java code.          Error
javac 1.6.0_29
src\anywheresoftware\b4a\popping\main.java:54: cannot find symbol
symbol  : variable sharedProcessBA
location: class anywheresoftware.b4a.BA
        processBA.sharedProcessBA.activityBA = null;
                 ^
1 error
I am not sure, but it could be related to java 1.6. try jdk1.7
 

salmander

Active Member
Licensed User
Installed JDK1.7 but it is just the same problem.
Then I don't know buddy...I remember I got this, in one of my project, but that wasn't because of the v2.0 upgrade, it was because I didn't copy the library files properly. fingers crossed, hopefully someone will be able to help you out.
 

nw11

Member
Licensed User
Error .. sub not found

i have installed the new version 2.0 and now i receive this error when callsub command is called ..

this is my code :

Sub Activity_Pause (UserClosed As Boolean)

If UserClosed = True Then
CallSub(service1, "disattivatimer")
Else
CallSub(service1, "attivatimer")
End If

End Sub


' this sub are under service1

Sub AttivaTimer
TimerService.Enabled = False
TimerService.Initialize("TimerService",5000) ' 5 secondi
SwTimer = 0
TimerService.Enabled=True
End Sub

Sub DisattivaTimer
TimerService.Enabled = False
TimerService.Initialize("TimerService",20000) ' 20 secondi
SwTimer = 0
TimerService.Enabled=True
End Sub

' this is the message i receive from the log

Partial wakeLock already held.
** Service (service1) Start **
Partial wakeLock already held.
** Activity (main) Pause, UserClosed = true **
main_activity_pause (java line: 761)

java.lang.Exception: Sub disattivatimer was not found.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:176)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:793)
at anywheresoftware.b4a.keywords.Common.CallSub(Common.java:774)
at newudp.it.main._activity_pause(main.java:761)
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 newudp.it.main.onPause(main.java:159)
at android.app.Activity.performPause(Activity.java:4563)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1198)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2705)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2674)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2652)
at android.app.ActivityThread.access$800(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1170)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4507)
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:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
main_activity_pause (java line: 761)

java.lang.RuntimeException: java.lang.RuntimeException: java.lang.Exception: Sub disattivatimer was not found.
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:798)
at anywheresoftware.b4a.keywords.Common.CallSub(Common.java:774)
at newudp.it.main._activity_pause(main.java:761)


the project is exactly the same of 1.90 version ..

please help !!
 

nw11

Member
Licensed User
Just downloaded and now find all my apps, have the following problem when I compile.

B4X:
Compiling code.                         0.48
Compiling layouts code.                 0.02
Generating R file.                      0.00
Compiling generated Java code.          Error
javac 1.6.0_29
src\anywheresoftware\b4a\popping\main.java:54: cannot find symbol
symbol  : variable sharedProcessBA
location: class anywheresoftware.b4a.BA
        processBA.sharedProcessBA.activityBA = null;
                 ^
1 error
i have received this error when i try to re-open my project under 1.90 version after have open it ( and saved ) under 2.00 .. be sure to have launched 2.00 ide ..
 

Aysic4Bandroid

Member
Licensed User
has a fix been found yet?

Hi,

Just received the v2.00 upgrade link, luckily i saw this forum thread before installing it. Has anyone found a fix yet for the problem highlighted here?? Cant wait to try it but i cant afford to have errors almost finished a current project.

BTW:
Do you have to uninstall the old version before installing the latest?

thanks
 

salmander

Active Member
Licensed User
hey everyone, is screenshot capture not working any more?
here is my code
B4X:
Sub TakeScreenshot (Activity As Activity)
   Log("TakeScreenshot activated")
      ' Take a screenshot.
   
      Dim Obj1, Obj2 As Reflector
      Dim bmp As Bitmap
      Dim c As Canvas
      Dim now, i As Long
      Dim dt As String
      DateTime.DateFormat = "yyMMddHHmmss"
      now = DateTime.now
      dt = DateTime.date(now) ' e.g.: "110812150355" is Aug.12, 2011, 3:03:55 p.m.
      Obj1.Target = Obj1.GetActivityBA
      Obj1.Target = Obj1.GetField("vg")
     bmp.InitializeMutable(Activity.Width, Activity.Height)
      c.Initialize2(bmp)
      Dim args(1) As Object
      Dim types(1) As String
      Obj2.Target = c
      Obj2.Target = Obj2.GetField("canvas")
      args(0) = Obj2.Target
      types(0) = "android.graphics.Canvas"
      Obj1.RunMethod4("draw", args, types)
      Dim Out As OutputStream
      Out = File.OpenOutput(File.DirRootExternal, dt & ".png", False)
      bmp.WriteToStream(Out, 100, "PNG")
      Out.close
   ToastMessageShow("Screenshot Captured", False)
End Sub
and here is the error i get
B4X:
TakeScreenshot activated
functions_takescreenshot (B4A line: 2047)
Obj1.Target = Obj1.GetActivityBA
java.lang.NoSuchFieldError: anywheresoftware.b4a.BA.activityBA
   at anywheresoftware.b4a.agraham.reflection.Reflection.GetActivityBA(Reflection.java:409)
   at com.home.cafiq.test.functions._takescreenshot(functions.java:766)
   at com.home.cafiq.test.search._activity_longclick(search.java:462)
   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.BA.raiseEvent2(BA.java:158)
   at anywheresoftware.b4a.BA.raiseEvent(BA.java:154)
   at anywheresoftware.b4a.objects.ViewWrapper$2.onLongClick(ViewWrapper.java:64)
   at android.view.View.performLongClick(View.java:3547)
   at android.view.View$CheckForLongPress.run(View.java:14087)
   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:4424)
   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:784)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
   at dalvik.system.NativeStart.main(Native Method)
 

nw11

Member
Licensed User
i have installed the new version 2.0 and now i receive this error when callsub command is called ..

this is my code :

Sub Activity_Pause (UserClosed As Boolean)

If UserClosed = True Then
CallSub(service1, "disattivatimer")
Else
CallSub(service1, "attivatimer")
End If

End Sub


' this sub are under service1

Sub AttivaTimer
TimerService.Enabled = False
TimerService.Initialize("TimerService",5000) ' 5 secondi
SwTimer = 0
TimerService.Enabled=True
End Sub

Sub DisattivaTimer
TimerService.Enabled = False
TimerService.Initialize("TimerService",20000) ' 20 secondi
SwTimer = 0
TimerService.Enabled=True
End Sub

' this is the message i receive from the log

Partial wakeLock already held.
** Service (service1) Start **
Partial wakeLock already held.
** Activity (main) Pause, UserClosed = true **
main_activity_pause (java line: 761)

java.lang.Exception: Sub disattivatimer was not found.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:176)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:793)
at anywheresoftware.b4a.keywords.Common.CallSub(Common.java:774)
at newudp.it.main._activity_pause(main.java:761)
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 newudp.it.main.onPause(main.java:159)
at android.app.Activity.performPause(Activity.java:4563)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1198)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2705)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2674)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2652)
at android.app.ActivityThread.access$800(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1170)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4507)
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:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
main_activity_pause (java line: 761)

java.lang.RuntimeException: java.lang.RuntimeException: java.lang.Exception: Sub disattivatimer was not found.
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:798)
at anywheresoftware.b4a.keywords.Common.CallSub(Common.java:774)
at newudp.it.main._activity_pause(main.java:761)


the project is exactly the same of 1.90 version ..

please help !!

now i have launched the 1.90 version that reconvert my files to the older version and all works .. at this moment i can't work with 2.0 version .. please advise me when then problem is solved or tell me what i have to change from my 1.90 project code to work with 2.00 !!
 

peacemaker

Well-Known Member
Licensed User
JDK1.7, one simple project is OK, will check others...
THANKS EREL !
 

nw11

Member
Licensed User
See my answer above. This error happens because you have an old BAShared.jar file in your additional libraries path.
my b4ashared.jar file is dated 19.06.2012 !!! how can i fix my error ?
 
Top