Android Question B4X and Compatibility

Marcos Alves

Well-Known Member
Licensed User
Hello all,

I noticed that in visual designer we have the option to add the views in the activities and B4XView, but I confess that for me it's not clear yet if I'll have advantages when translating a B4A app to B4i using that kind of approach... for example, I tried to reference the padding property of an editText view declared as B4XView and didn't find this - later I saw that I must to reference in the code the B4X view as the specific element that I want to define the property. Something like this:
B4X:
Dim textAndroid as edittext
textB4x = textAndroid
textAndroid.padding = array as int(1,1,1,1)
This looks more complicated instead to be easier when translating to B4i... Am I wrong? What am I not seeing here?
 

Marcos Alves

Well-Known Member
Licensed User
Why aren't you setting the padding in the designer?
Because in runtime I add some views dynamically whose will define if I'll need or not to change the properties of others. The padding is only an example but there are some other specific properties in imageViews, for example, those aren't available in B4Xviews and must to be referenced in the code if you need to use them... am I doing something wrong?
 

Erel

Administrator
Staff member
Licensed User
I've asked this question because the best way to set the platform specific features is with the designer.

If you are adding views dynamically then you must start with the native type. You can later switch to a B4XView. This is not really relevant to this discussion.

There is no right or wrong here. If you are building cross platform solutions then you should prefer using B4XViews.
There are also other advantages to B4XViews.
And you can always switch back and forth between the types so it is not a too important decision.
 

Marcos Alves

Well-Known Member
Licensed User
I've asked this question because the best way to set the platform specific features is with the designer.

If you are adding views dynamically then you must start with the native type. You can later switch to a B4XView. This is not really relevant to this discussion.

There is no right or wrong here. If you are building cross platform solutions then you should prefer using B4XViews.
There are also other advantages to B4XViews.
And you can always switch back and forth between the types so it is not a too important decision.
Thanks @Erel ,

I was worried because I'm writing some large apps in B4A and will need to convert to B4i later - I was really thinking if either to check or not the B4XView in "Generate Members" designer tool was something that I could to regret later :) ...

Really thanks!
 
Top