Basic4android v2.20 BETA is released

Erel

B4X founder
Staff member
Licensed User
Longtime User
I'm happy to release v2.20 beta to the beta testers.

This version includes the following improvements:
  • For Each blocks
  • Declaration and assignment in the same statement - Two new language features in the next version
  • B4A-Bridge - many stability improvements related to both Bluetooth mode and wireless mode
  • B4A-Bridge supports logging on all devices including Android 4.1+. Requires B4A-Bridge 2.07
  • Menu items will now appear in the action bar on Android 3.0+ devices
  • Default target level set to 14
  • WYSIWYG designer uses device default theme. Supports changing themes: New feature: better support for modern Android themes
  • Designer includes a new color value: DEFAULT. The meaning of this value is that the theme default color will be used.
  • Designer script new keywords make it easier to build user interfaces that scale correctly on all phones and tablets: Min, Max, AutoScale, AutoScaleAll and AutoScaleRate: New feature: AutoScale and other new designer script keywords
  • Optimized designer layout files - loading time is 3 - 4 times faster
  • MediaPlayer can play files from File.DirInternal
  • Map.Keys / Values - allows iterating over map entries with For Each
  • Panel / Activity.RemoveAllViews
  • LayoutValues.ApproximateScreenSize - returns the approximate device physical screen size
  • Sign key alias key can be changed (requires editing the settings file)
  • Activity/Panel.LoadLayout can now be used from classes
  • Camera_Preview event

Many bugs were fixed including:
  • Recycle error in ListView_ItemClick event
  • TabHost.AddTabWithIcon / AddTab - correctly calculate the width and height
  • Code documentation should be updated almost immediately
  • Upper casing of single letter variables
  • Memory leak when opening large projects
  • Non activity classes can call code modules
  • WYSIWYG Designer and B4A-Bridge listen to an alternative port if the main one is already bound.
  • Fixed debugger error related to complex objects with circular references

Notes
  • Layout files saved in the new version cannot be loaded on older versions of the IDE
  • Libraries in the internal libraries folder have first priority (changed from previous versions)
  • B4A.xml file was updated. If you are using a custom color scheme then you can copy the relevant section to the new file.

Beta testers, please backup your projects before loading them with the new version.

Existing beta testers should receive an email with installation instructions. If you want to join the beta testers then please send an email to [email protected], note that the beta is only sent to users who are eligible to free upgrades.

Thank you for your help. Please post any feedback or question in this forum. Issues should be posted as new threads in this forum.
 

thedesolatesoul

Expert
Licensed User
Longtime User
Hi Erel,
A couple of questions.
1. How does the action bar work, does it show an overflow menu only? Or also icons? Is this already part of the framework for Android 3.0+ devices i.e. I used to think it was a separate component you needed to use.
[*]Menu items will now appear in the action bar on Android 3.0+ devices

2. How does MediaPlayer get access to DirInternal? Is it now running in the same process as the app? Also, does this affect the VideoView too?
[*]MediaPlayer can play files from File.DirInternal

3. No remote compile in this version?

Thanks.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. It shows the menu items icons or text. If there isn't enough room then the three dots will appear, holding the other items.
The action bar is part of Android 3.0+ framework. In order for it to show, the manifest file should include: android:targetSdkVersion="11" (or above). The default for new projects is now 14. For existing projects you will need to add it.

2. It is done in the same way that assets files are accessed. It doesn't affect VideoView.

3. Remote compilation is not planned for the full version. It is a good way to demonstrate Basic4android to new developers. However local compilation mode is more powerful and much better suited for large projects.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
1. It shows the menu items icons or text. If there isn't enough room then the three dots will appear, holding the other items.
The action bar is part of Android 3.0+ framework. In order for it to show, the manifest file should include: android:targetSdkVersion="11" (or above). The default for new projects is now 14. For existing projects you will need to add it.

2. It is done in the same way that assets files are accessed. It doesn't affect VideoView.

3. Remote compilation is not planned for the full version. It is a good way to demonstrate Basic4android to new developers. However local compilation mode is more powerful and much better suited for large projects.
Thanks Erel and congratulations for yet another great version.
All of these features will be very useful. I was also hoping for Remote compile (and B4A Bridge also connecting remotely), sounds like a good way to isolate the IDE, compiler and deployment.
 
Upvote 0

Roger Garstang

Well-Known Member
Licensed User
Longtime User
Would the way B4A handles the declarations now ever allow for something like:

Dim RemarkView As EditText = New Editext.Initialize("EditEventPrefix")
or
Dim RemarkView As New EditText.Initialize("EditEventPrefix")
or
Dim RemarkView As EditText.Initialize("EditEventPrefix")
or
Var RemarkView= New EditText.Initialize("EditEventPrefix")

Whatever format style would work best. Not many of my variables I set to something are simple types like Int, String, etc. First thing I saw was all the Initialize statements I could do away with and make sure they are initialized in the Dim.
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Erel

Thanks for this, I'll install tonight or tomorrow night. I've only just got my new Dev rig working - MacBook Air, running B4A on a VMWare Fusion XP Pro install.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Would the way B4A handles the declarations now ever allow for something like:

Dim RemarkView As EditText = New Editext.Initialize("EditEventPrefix")
or
Dim RemarkView As New EditText.Initialize("EditEventPrefix")
or
Dim RemarkView As EditText.Initialize("EditEventPrefix")
or
Var RemarkView= New EditText.Initialize("EditEventPrefix")

Whatever format style would work best. Not many of my variables I set to something are simple types like Int, String, etc. First thing I saw was all the Initialize statements I could do away with and make sure they are initialized in the Dim.
Such syntax is currently not supported. I do not know whether it will be supported in the future.

For now you can do something like:
B4X:
Dim o1 As SomeObject = CreateSomeObject(...)

Sub CreateSomeObject(Param1 As ...) As SomeObject
 Dim o As SomeObject
 o.Initialize(Param1)
 Return o
End Sub
 
Upvote 0

Roger Garstang

Well-Known Member
Licensed User
Longtime User
I think my tooltip issues went away. I have yet to have it not show documentation for my Classes or show that solid black block where the tooltip should be. We will see what happens after lunch, but it is looking good so far and they appear to show faster too.

Only thing that would be cool now is for Ctrl to show a tooltip if pressed within a line that has one and for some indication as to what parameter the cursor is on in the tooltip.
 
Upvote 0

MrRey

Member
Licensed User
Longtime User
Just a minor thing, but when I click Help|About, it says version 2.14.

Just thought I'd tell you. ;)
 
Upvote 0

alfcen

Well-Known Member
Licensed User
Longtime User
A variable initialization fails at compilation with the following error message


Compiling code. 0.16

ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code. 0.00
Generating R file. 1.95
Compiling generated Java code. Error
javac 1.7.0_03
src\requio\com_nz177jp\solunar\calc.java:28: エラー: 式の開始が不正です (=illegal initialization of expression)
texture = = new int[(int)(1)];
^
注意:一部の入力ファイルは推奨されないAPIを使用またはオーバーライドしています。

(=Warning: Part of the input file targets not recommended API or overwrites it)

注意:詳細は、-Xlint:deprecationオプションを指定して再コンパイルしてください。
エラー1個

(=Warning: Set Xlint:depreciation object and recompile

probably in this line of code:

B4X:
Type GLObject(ready As Boolean,texname As String, filteredtexture As Boolean, texture(1) As Int, numQuads As Int,numTris As Int, verts() As Float, uvs() As Float, normals() As Float)
   Dim obj1 As GLObject

No such error with V2.02. Anything that needs to be adjusted?
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
feature to select and delete all files in Files Tab

Hi Erel, would it be possible if at all to add some sort of feature where one would be able to select multiple files in the Files tab and delete, when i work on live wallpapers i have a template i use all the time, so i find myself selecting the files one by one in order for me to delete, if i have let's say 300 image files and i want to delete say the first 100, i have to select one by one and it's time consuming, or is there a way to already do this, if not this would be a nice feature to have and i don't think it would be too hard to Ad :).

just a thought Erel.

Cheers,
Walter
 
Upvote 0

alfcen

Well-Known Member
Licensed User
Longtime User
HTTP Error raised

Using Android 4.x tablet.
With 2.02 min SDK 4, no problems.
Force Close with V2.2 beta and min SDK 14 when attempting to download an XML file.

** Service (http) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (http) Create **
** Service (http) Start **
** Service (http) Start **
http_hc_responsesuccess (java line: 115)
android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:163)
at libcore.io.IoBridge.recvfrom(IoBridge.java:503)
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103)
at org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:120)
at org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:211)
at org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:183)
at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:155)
at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:175)
at org.apache.http.impl.io.ChunkedInputStream.exhaustInputStream(ChunkedInputStream.java:289)
at org.apache.http.impl.io.ChunkedInputStream.close(ChunkedInputStream.java:262)
at org.apache.http.conn.BasicManagedEntity.streamClosed(BasicManagedEntity.java:179)
at org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:266)
at org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:213)
at libcore.io.IoUtils.closeQuietly(IoUtils.java:51)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:281)
at anywheresoftware.b4a.objects.SaxParser.parse(SaxParser.java:78)
at anywheresoftware.b4a.objects.SaxParser.Parse(SaxParser.java:71)
at requio.com_night.clock_astro_tablet.paid.http._hc_responsesuccess(http.java:115)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:165)
at anywheresoftware.b4a.BA$3.run(BA.java:301)
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)
java.lang.RuntimeException: android.os.NetworkOnMainThreadException
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
at anywheresoftware.b4a.BA$3.run(BA.java:301)
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)
Caused by: android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:163)
at libcore.io.IoBridge.recvfrom(IoBridge.java:503)
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103)
at org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:120)
at org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:211)
at org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:183)
at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:155)
at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:175)
at org.apache.http.impl.io.ChunkedInputStream.exhaustInputStream(ChunkedInputStream.java:289)
at org.apache.http.impl.io.ChunkedInputStream.close(ChunkedInputStream.java:262)
at org.apache.http.conn.BasicManagedEntity.streamClosed(BasicManagedEntity.java:179)
at org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:266)
at org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:213)
at libcore.io.IoUtils.closeQuietly(IoUtils.java:51)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:281)
at anywheresoftware.b4a.objects.SaxParser.parse(SaxParser.java:78)
at anywheresoftware.b4a.objects.SaxParser.Parse(SaxParser.java:71)
at requio.com_night.clock_astro_tablet.paid.http._hc_responsesuccess(http.java:115)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:165)
... 10 more

The service module code is:

B4X:
'Service module
Sub Process_Globals
   Dim hc As HttpClient
   Dim Parser As SaxParser
End Sub

Sub Service_Create
    hc.Initialize("hc")
   Parser.Initialize   
End Sub

Sub Service_Start'(StartingIntent As Intent)
    Dim Request As HttpRequest
   Request.InitializeGet("http://ws.geonames.org/findNearByWeatherXML?lat=" & Main.lat & "&lng=" & Main.lon)
   hc.Execute(Request, 0)
End Sub

Sub Service_Destroy

End Sub

Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
   Dim Result As InputStream
   Result = Response.GetInputStream 'GetString("UTF8") 'Convert the response to a string
   Parser.Parse(Result, "Parser")
   Result.Close
   CallSub2(Main,"HTTPDownloadComplete", TaskId)
End Sub

Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
   If StatusCode = -1 Then Reason = "Failed to get weather data"
   ToastMessageShow(Reason ,False)
    If Response <> Null Then Response.Release
   ProgressDialogHide
End Sub 

Sub Parser_EndElement (Uri As String, Name As String, Text As StringBuilder)
   If Parser.Parents.IndexOf("geonames") > -1 Then
      If Name = "temperature" Then
          Main.temperatureC = Text.ToString & Chr(176) & "C" '& " / " & 
         Main.temperatureF = Fahrenheit(Text.ToString)
      Else If Name = "humidity" Then
         Main.humidity = Text.ToString & "% RH"
      End If
   End If
End Sub

Sub Fahrenheit(Tc As String) As String
   Return Round2((9/5)* Tc + 32,1) & Chr(176) & "F"
End Sub
 
Upvote 0

alfcen

Well-Known Member
Licensed User
Longtime User
Menu Button with SDK 14

This issue has been thrown in before, so, I just like to add +1.
Perhaps I need to get more familiar with Android 4.x.

The image at the left shows the menu button [:] after compilation with SDK 4.
At the right, the button vanished after compilation with SDK 14.
There is absolutely nothing at the top.

The title bar in Android 4.x displays the app icon, compromising vertical
space, in that I'd rather prefer to target SDK 4, if that would not introduce
conflicts with B4A V2.2
 

Attachments

  • sdk4.png
    sdk4.png
    84.4 KB · Views: 379
  • sdk14.png
    sdk14.png
    83.9 KB · Views: 351
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
Hi,

i tried the Sliding Panels Example from the forum and get this compile time error:

Compiling code. 0.06
Compiling layouts code. 0.01
Generating R file. 0.14
Compiling generated Java code. Error
javac 1.6.0_21
src\anywheresoftware\b4a\samples\slidingpanels\slidingpanels.java:22: illegal start of expression

Panels = = new anywheresoftware.b4a.objects.PanelWrapper[0];
^
1 error

What means 'Default target level set to 14'; must we change any java installation?

Greetings from austria,
Reinhard
 
Upvote 0

alfcen

Well-Known Member
Licensed User
Longtime User
Hi rboeck
Good knowing that I am not alone. I reported an "illegal start of expression" error, too.

Regarding min SDK, this refers to Project/Manifest editor, where you can
change the target minimum SDK. Sample:


'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: Manifest Editor
AddManifestText(
<uses-sdk android:minSdkVersion="14" />
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:screenOrientation="landscape"
android:anyDensity="true"/>)
SetActivityAttribute(main,android:screenOrientation, "sensorLandscape")
SetActivityAttribute(settings,android:screenOrientation, "sensorLandscape")
SetActivityAttribute(locations,android:screenOrientation, "sensorLandscape")
SetActivityAttribute(webview,android:screenOrientation, "sensorLandscape")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

In my believe a new Java installation is not required, but I don't want to speculate at this time.

Until we get a response, I recommend to stay with android:minSdkVersion="4".
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
Menus and Autoscaleall works great

Hi,

I tested a few features and all seem to work fine. Not sure about the action bar because most new apps. have a static action bar or even one depending on selected features. Need to test it a little more.

Anyway, great improvements!
 
Upvote 0
Top