Android Question Translating an old app to B4XPages: Is it time to give up?

GuyBooth

Active Member
Licensed User
Longtime User
I have posted a few of the [problems I face on translating my app. They represent problems I am seeing in the very early stages - even with forcing my way around some of them I have not yet reached the meat of the app. Other problems I have seen include IME not behaving (crashing the app when I open the keyboard), SQL cursors showing as not initialized when I run instances of UltraListView, Screen layouts different the first time they appear from when they are opened a second time, ....

None of this is due to lack of help from the B4X community, which as usual is outstanding.

I now have to decide whether it is worth my time. Having spent a week so far, it doesn't look promising.
All I was trying to achieve was to change the colour of an icon as shown in the images below. If anyone knows how to do this programmatically without using B4XPages I would love to see the solution!
Yes this part works with B4XPages when added to the three pages example - Clicking the Red Microphone changes it to a green one (and does some other stuff).

Screenshot_20230109-132225.jpg
Screenshot_20230109-132232.jpg
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
So you're just wanting to change the icon for the menu item right? It's definitely doable in Java/Kotlin, so you should be able to do it with a JavaObject if B4A still doesn't implement that functionality. You'll need to get a reference to the MenuItem, then call the setIcon() method, which takes a resource int as the argument.

Rewriting the entire app for that one little function does seem a bit like overkill, but if there are other reasons (like long-term maintainability) then it might be worth the effort.

- Colin.
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
What I've learned from decades of hardware and software migrations is that a quick "one-step" migration and certainly not the fastest and not the easiest way at all. Simply because then you don't know what the cause is and where to start to find a solution for how many problems.
With an old program it is therefore better to first go to the latest API level and only when it works flawlessly start migrating to B4X pages.
This way the difference becomes clear between a problem caused by a higher Android API and a problem caused by the migration from an Android B4A program to a B4X program.
It is also not unimportant, when you make B4X programs, to release certain things that only work with one OS. It is simply the best approach to only use B4X solutions and components. This saves you the headache of having to solve something for each OS differently. Certainly Android has started to apply more and more restrictions to prevent all kinds of abuse. And that's where the charm and power of a B4X solution comes in. When a standard B4X component is affected by a newly imposed restriction, the entire community looks for a solution.
 
Upvote 0

GuyBooth

Active Member
Licensed User
Longtime User
I'm only working with one OS (Android) on this project. I agree it is sometimes easier to start almost from scratch, but I am trying to bypass what could be a mountain of work.
As it is, I have found that if I can "break through" to the code beyond the opening screens, it looks as though most of it is workable without much change, so for the time being I will keep trying.
I guarantee though - there will be more postings with the title "Translating an old app to B4XPages" ...

 
Upvote 0

GuyBooth

Active Member
Licensed User
Longtime User
I think I now have it all working. Most of it was fairly straightforward, but the code flow timing overlap etween Page_Create and Page_Appear, especially in the main page, gave me quite a bit of trouble.
 
Upvote 0
Top