Android Tutorial Conversion of B4A to B4XPages

Introduction

The conversion of the first of my B4A Apps to the newer B4XPages structure was not trivial and involved over 20 hours of research, overcoming misunderstandings, and finding answers to many questions. This document is intended to be a reference for anyone that undertakes the task. Hopefully, it will help speed up the process.

Some of the steps are very short and most are quite mechanical so don’t be dismayed by the number of steps. After the first conversion you will get faster and any shared modules will help a lot. My own learning curve and this doc reduced the conversion time from over 20 hours to around 6 hours for most apps. Now all my apps have the same B4XPages structure, use the new Title Bar Menus, and use B4XViews. I have not bitten off B4I yet, but hopefully I will be better positioned to do it.

You may run into a library or other situation that can add time to your conversion. The GPS and Blue Tooth mods mentioned below added hours to my effort and weren’t solved without Erel’s help.

You can use the checklist at the end of the doc to document your own progress.

This pdf illustrates the level of my knowledge and I will not be able to answer any questions related to other issues.

References

Primary reference: [B4X] B4XPages - Cross platform and simple framework for managing multiple pages | B4X Programming Forum
XUI views reference: [B4X] [XUI] Cross platform & native UI library | B4X Programming Forum
Methods to avoid: [B4X] Features that Erel recommends to avoid | B4X Programming Forum
Code ‘Smells’: [B4X] "Code Smells" - common mistakes and other tips | B4X Programming Forum

The pdf documents (attached) include:

Section 1. Introduction and references.
Section 2. Choose the Basic Approach.
Section 3. The Conversion
Step 1. Create the new project with an 'X' name.
Step 2. Copy your existing infrastructure.
Step 3. Modify 'Main'.
Step 4. Add your 'Files' to the app.
Step 5. Add your libraries.
Step 6. Replace your manifest.
Step 7. Load Starter and other classes.
Step 8. Modify B4XMainPage.
Step 9. Compile the project and load any database.
Step 10. Load any shared modules.
Step 11. Modify Activities to Classes.
Step 12. Handle additional problems.
Step 13. Convert menus to the title bar.
Step 14. Transition to the use of B4XViews.
Step 15. Update any Help files.
Step 16. Transition the app back to the original app name.
Section 4. Common Errors.
Section 5. Checklist for App Conversion.

Sorry, I had to break up the pdfs so they could be uploaded.

If you have comments/corrections on anything please let me know and I will certainly fix it.

If this doc saves you time and you want to help, please feel free to download 'Rate My Shows' from the Play Store. It is free without ads at present but does include an optional $2.99 annual subscription if you care to donate. If you watch Netflix, Amazon Prime, HBO, etc. and can't keep up with what you've watched and not watched, this app might help. If you have a spreadsheet already, you can import it.

Just downloading it will give me some customer counts and I hope you like it. Tell your friends as well.
 

Attachments

  • Section 1-2.pdf
    469.4 KB · Views: 656
  • Section 3 Step 1-11.pdf
    501.9 KB · Views: 568
  • Section 3 Step 12.pdf
    488.1 KB · Views: 485
  • Section 3 Step 13.pdf
    456.3 KB · Views: 635
  • Section 3 Step 14.pdf
    450.6 KB · Views: 463
  • Section 3 Step 15-16.pdf
    457.5 KB · Views: 521
  • Section 4-5.pdf
    393.4 KB · Views: 457

LucaMs

Expert
Licensed User
Longtime User
In concrete terms, in a few cases it is worthwhile to convert a B4A project into a B4XPages one; especially if the project is very large. It would be appropriate to do this only if the B4i-iOS version were also to be created.

Starting a new B4XPages project is, on the other hand, very easy and intuitive.
 

AnandGupta

Expert
Licensed User
Longtime User
I think in all cases it’s very advantageous to convert your project to B4XPages.
Yes the biggest benefit, as stated by Erel, freedom from handling Activity nightmare.
You just concentrate on what you want to achieve not what Android forces you to.
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
Actually I've found only one showstopper that prevents me from converting a big project to B4XPages: the lack of dynamic portrait/landscape support.
Allowing the user to switch orientation at runtime is a must for my project
 

AnandGupta

Expert
Licensed User
Longtime User
Actually I've found only one showstopper that prevents me from converting a big project to B4XPages: the lack of dynamic portrait/landscape support.
Allowing the user to switch orientation at runtime is a must for my project
I too was having this notion but then I looked in many apps in GPlay and I found that for showing report, list (with wide text), image view etc. all other layout do not require landscape mode. So in B4XPages default portrait I have all but for the reports I use another activity.

There are many app samples uploaded in forum using similar way now.
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
I too was having this notion but then I looked in many apps in GPlay and I found that for showing report, list (with wide text), image view etc. all other layout do not require landscape mode. So in B4XPages default portrait I have all but for the reports I use another activity.

There are many app samples uploaded in forum using similar way now.
My use case is for the whole app, not a single activity.
As as example: would you find acceptable for "Google Maps" not being able to change orientation? I usually search for a destination in portrait, then switch to landscape while locking the phone to the car holder before starting driving
 

asales

Expert
Licensed User
Longtime User
But if you already have a big working B4A project and don't need to develop the iOS-B4i version now it's not worth it.
👏 this is my case. I developer only to Android and have several and large projects that works with activities and it would take a huge enffort to convert to b4xpages. Thanks, but not.
 
Top