Support for Fragments

moster67

Expert
Licensed User
Longtime User
Last edited:

Inman

Well-Known Member
Licensed User
Longtime User
+1

There are over 70 million Android 4.0 users and with the release of Nexus 7 there could be over 15 million tablet users. Supporting them would be nice.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Support for fragments may be added in the future. Fragments have several drawbacks:
- Only natively supported from Android 3.0. There is a compatibility library. However from a single project you can either use the compatibility library and thus support all devices or use the native features and only support Android 3.0 and above devices. The support library doesn't support all the features.
- They are quite complicated. You can read about fragments here: Fragments | Android Developers

I think that currently most users will not find them very useful nor simpler than implementing two layout variants, one for a phone and one for a tablet.
 

moster67

Expert
Licensed User
Longtime User
I already had a look at the documentation about Fragments, the support-library etc.

I also read opinions from other Java-developers and most of them are seeing the Fragments as something positive, even the possibility to make them work on devices prior to Honeycomb (3.0).

In my opinion, supporting Fragments would be another step in making B4A more "standard" and even more "onpair with" with native Android-development using Java. It gives also more flexibility. I guess Google introduced Fragments on purpose because they saw a need for it (read tablets) even if developers could use panels and multi-layouts as an alternative. They also realized the need of the Support-library.

I agree that it looks rather complicated but I guess as with many other things, once you get to know it, it becomes more simple. You just need time to test it, normally by trial and error.

Now I don't know how difficult a task such as implementing support for Fragments in B4A would be so that is something that only you Erel could decide and value if it is worthwhile or not.

I am pleased to know that you might at least consider it in the future so in the meantime, I will stick with my panels etc :)
 

Lee Gillie CCP

Active Member
Licensed User
Longtime User
Fragments truly are challenging. I believe the thing to remember is that the greatest appeal of B4A is that it simplifies development concepts. Providing for modularization and code sharing within a project, and even across projects is what we want. There is something wrong when you find yourself copying large blocks of code and layout between activities, either in how you are thinking about the problem, or in what the tools are requiring of you. Anyone developing for say Windows Forms, for example, can picture how they want to approach a complex task, and looking for such solutions in Android Fragments is frustrating at best. I think that rather than supporting native fragments, which is not a cross platform solution, but rather a fragment-like concept where there is perhaps an underlying notion of subordination for activities and layouts that might built into B4A runtime, and hopefully can be abstracted to iOS as well. I'm not yet a master of B4A (yet), but I like what I see so far. If you provide simplification of screen modularization in the mobile planet, then the world will beat a path to your door.
 
Top