Fragment reality check

So, what does this Fragment stuff really do for us? Our first Fragment mini-app would have the same appearance and functionality had we not bothered with the Fragment at all.

In fact, using Fragment has made the whole thing more complicated! Why would we want to do this?

We kind of know the answer to this already; it just isn't especially clear based on what we have seen so far. We know that a Fragment, or fragments, can be added to the layout of an Activity.

We know that a Fragment not only contains its own layout (view), but also its very own code (controller), which, although hosted by an Activity, is virtually independent.

Our quick app only showed one Fragment in action, but we could have an Activity that hosts two or ...

Get Android Programming for Beginners - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.