Other Converting a B4A app to B4i


Well-Known Member
Licensed User
Longtime User
I've finally found some spare time to port a B4A app to B4i.
Here are my notes on it
The app is already published for B4A

Some time ago I've already converted the project to B4XPages, and I used the XUI framework while writing the B4A version, so I thought the porting would be easy.

First step was porting it to B4J.
Working in B4J allows a faster development cycle: checking the results is faster than compiling on a Mac and testing on the device.
While I do not plan to release a desktop version of my app, this porting step highlighted some of the hidden dependencies of the B4A version with the underlying platform.
This forced me to clean up the codebase a little, which actually eased the subsequent port to B4i.
The whole process took about 2 full days.

The main issues I've stumbled upon were:

1) in B4A I used Labels to show bitmaps, by setting their background.
This is possible in the designer with B4i also, but I found that changing the B4XView.Background property at runtime raises an exception on B4i.
I solved this by converting all the Labels used to display pictures, to ImageView in the designer.
Since ImageView can be addressed as B4XView also, no code changes were required.

2) the SQLite implementation of iOS seems to handle concurrent queries far worse than the Android version.
Even if I used the WAL pragma of SQLite, concurrent updates and selects (even on different tables) were visibly slower than the Android and the B4J version.
After some testing I've found the problem was the simultaneous execution of an update and a select: they were processed concurrently, but really slow compared to Android.
While on Android this worked fine by running the two Async queries with two resumable subs, one after another, on iOS I had to sequentialize them using Wait For.

The app is available here