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 erel@basic4ppc.com, 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.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Just a minor thing, but when I click Help|About, it says version 2.14.
This is the actual version of the current beta.

Any Examples of using For Each with a Map, and (if it is possible) an SQL Cursor?
B4X:
'Assuming that Map1 holds entries made of strings as keys and views as values
'If we need to go over the values:
For Each v As View in Map.Values
 V.Left = 100dip
Next

'If we need to go over both values and keys
For Each s As String in Map.Keys
 Dim v As View = Map.Get(s)
 ...
Next
You cannot use For Each with cursors.

Force Close with V2.2 beta and min SDK 14 when attempting to download an XML file.
The problem is that you are reading from a network stream with the main thread. This is not related to V2.2 only to the min SDK 14. You can either remove the targetSdkVersion="14" (or minSdkVersion) or you can use HttpUtils2 which will download the complete stream in the backroung.

I will investigate the issue with the variables declaration and report.

Please start new threads for any issue or question. This thread is too difficult to follow
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
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
There is no problem with targeting a different version. Note that you can also remove the title bar (under project - Activity properties).

There is a bug in the first beta related to arrays declared inside Types. This causes the issues described in previous posts. I've uploaded a new beta to the same location. It should fix this issue (it is still v2.14).
 
Upvote 0

gulliver

Member
Licensed User
Longtime User
B4a is too a great product.
As a new user I am amazed from assistance offered on site.
Thanks Erel. :icon_clap: :sign0098: :sign0188:
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Clarification about the new menu / action bar related feature.

This change only affects applications that explicitly add android:targetSdkVersion="11" (or above) to the manifest editor. When the manifest includes this attribute, the application will use the new Android 3.0+ design on Android 3.0+ devices (it will look like any other application on older devices). This change causes the menu button to disappear. This means that the menu feature cannot be used in that case.

Starting from B4A v2.20 the menu items will appear in the action bar or the overflow menu at the top.
I highly recommend you to read this blog to better understand the design change:
Android Developers Blog: Say Goodbye to the Menu Button
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
Hi from austria,

my problem with sliding panels is away with the newer beta version. One thing, i found out now, is, that the inputtype decimal numbers ist not working. The normal text keyboard is used for input.
One of my oldest problems with the motoroly defy is also solved: the default value helped me, to make the design perfect!

Greetings
Reinhard
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
One thing, i found out now, is, that the inputtype decimal numbers ist not working.
Can you please start a new thread about this issue, and post the code that demonstrates it?

One of my oldest problems with the motoroly defy is also solved: the default value helped me, to make the design perfect!
Great :)
 
Upvote 0

alfcen

Well-Known Member
Licensed User
Longtime User
The 3 issues reported

Hi Erel

1. Menu button: understood, good knowing I can still trust my eyes :cool:
2. HTTP request under SDK 14: understood, I will modify as need be.
3. Variable initialization error: gone with the latest update! Thanks so much !

And, from now on, I will open a new thread for every issue. Sorry, for making things unnecessarily complicated.

Cheers
Robert
 
Upvote 0

mvpmedia

Member
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.

How is the performance? on mine it slows the laptop to a crawl when working with b4a.
 
Upvote 0

Roger Garstang

Well-Known Member
Licensed User
Longtime User
What is the "standard" for accessing/using the Back Key now? If Sub Activity_KeyPress is used for something like a confirmation prompt the Back Key no longer exits the activity. Are we to always return True now to consume it and call Activity.Finish ourself?

For the Action Bar additions I have a device with a physical menu key, so I only get the first 2-4 items from my menu there and no [...] button. Pressing the Physical Menu key gets me the rest of the list. This might be confusing to the user with no indication that there is more. And, is that always the first items put in the Actionbar or can it be any type of priority or common items specified to keep a menu order, but show Often Used ones there instead of in order by creation?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
What is the "standard" for accessing/using the Back Key now? If Sub Activity_KeyPress is used for something like a confirmation prompt the Back Key no longer exits the activity. Are we to always return True now to consume it and call Activity.Finish ourself?
Nothing related to the back key has changed in this version.

For the Action Bar additions I have a device with a physical menu key, so I only get the first 2-4 items from my menu there and no [...] button. Pressing the Physical Menu key gets me the rest of the list. This might be confusing to the user with no indication that there is more
I agree, however this is how Android is designed. If your device has a physical menu button then the three dots will not appear.

You will need to add the often used items first. There is no other priority.
 
Upvote 0

Roger Garstang

Well-Known Member
Licensed User
Longtime User
Nothing related to the back key has changed in this version.

Have you tried it? I mentioned it in the other thread when you first talked about the Theme/SDK changes. The key processing changed in Android after SDK 4. If you make a prompt to confirm exiting on pressing the Back key then the Back key doesn't close the activity. I have converted a couple of mine to how I mentioned in order to test and it appears to work...I am mostly curious in how that will change things like Sub Activity_Pause (UserClosed As Boolean) to know if it is UserClosed or not if I call Finish myself in code. The new key processing also added new flags and such that B4A could use to determine things like if the key came from physical or virtual keyboard and other advanced processing.
 
Upvote 0

Roger Garstang

Well-Known Member
Licensed User
Longtime User
Can you post a simple code that demonstrates the change in behavior?

Note that v2.20 doesn't force you to explicitly target sdk level 14.

This code worked before:

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
   If KeyCode = KeyCodes.KEYCODE_BACK AND Msgbox2("Are you sure you wish to Exit?", "Confirmation", "Yes", "", "No", Null) < -1 Then Return True
End Sub

With latest Beta I press Yes and the activity stays.

I know it isn't required and the best line for applications not wanting to take advantage of ICS level capabilities would be- <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="4"/>
But, those taking advantage of the new features would need to know of this change.
 
Upvote 0

Roger Garstang

Well-Known Member
Licensed User
Longtime User
  • TabHost.AddTabWithIcon / AddTab - correctly calculate the width and height
  • Non activity classes can call code modules

* What exactly did this fix on Tabs? A while back I switched my tabs to just be one image including text because the text kept drawing on top of the image and made it hard to read. I decided to try it out again with image and text on its own and use the TargetSDK of 14. On a Android 2.3.4 device the text still draws on top of the image. On an Android 3.x Tablet the Image is drawn to the left of the text. On an Android 4.x Phone it is not drawing the image at all and the the text is centered.

* There was another issue reported about using Activity in a class where you type it and it is highlighted like a keyword, but typing . does nothing...this still happens. I also had a weird issue a couple times yesterday where I used Activity in a regular activity module and when I switched lines it didn't change the first letter to uppercase. I switched tabs to another activity and back and it suddenly worked again. I couldn't get it to do it again, so I'm not sure of the cause.
 
Upvote 0

eps

Expert
Licensed User
Longtime User
How is the performance? on mine it slows the laptop to a crawl when working with b4a.

Oops, just installing now... Will let you know :)

Installed.

There was an initial issue with the R file not generating, but once I'd exited the App and allowed some Windows XP Pro updates to install it worked fine. It doesn't seem too slow either. Although mine is brand new - well only 4 months old and I've resisted installing too much so far.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
What exactly did this fix on Tabs?
100%x and 100%y in the designer script were not calculated correctly in some cases.
Android 4 TabHost doesn't show images.

There was another issue reported about using Activity in a class where you type it and it is highlighted like a keyword, but typing . does nothing
I'm unable to reproduce it. Can you post a small example?
 
Upvote 0

Roger Garstang

Well-Known Member
Licensed User
Longtime User
Android 4 TabHost doesn't show images.

I'm unable to reproduce it. Can you post a small example?

If I specify Image only and no text it shows the image on Android 4.x. This is very inconstant behavior.


As for Activity. I just have a Class that is considered an Activity Class from objects used. I try to use Activity though and it doesn't work. If I create an Activity object/variable in previous 2.02 it would show methods/properties but gave errors when used. I haven't tried creating a variable of type Activity in 2.2, but I'm guessing since typing dot after Activity on its own is still broke it would be too.
 
Upvote 0
Top