Posted by : Rhyf Ahmad Saturday, May 23, 2015

Now that you have written some Android code you know that Activity, View, and the layout and widget subclasses of View are among the most important classes in Android. Typically, an Android user interface is built from widget views organized in layouts: a ListView in a LinearLayout, for instance.
A single hierarchy of view objects gets loaded from a resource (or created by code) when an Activity is started. It is initialized and displayed on the device screen. For small screens, this is fine: users move from screen to screen to access different parts of a program’s UI, and the Activity class (Android’s concept of a task) supports a back stack that enables quick and intuitive traversal through the strictly tree-structured interface.
This changes completely, however, when the UI is spread over the surface of a larger tablet screen. Some parts of the screen remain constant over longer durations than others. Some parts of the screen determine the contents of other parts. A cardstack metaphor just doesn’t cut it. It is entirely possible to implement UIs in which some parts of the screen change in response to activities in another part, simply by showing and hiding views.
Android’s developers decided, however, that they needed more than just convention to encourage great large-screen UIs with a consistent feel and behavior. To facilitate this new kind of interaction, they introduced a new feature based on the Fragment class, as part of the Android 3.0 SDK (API 11, Honeycomb). A Fragment object is somewhere between a View and an Activity. Like a View, it can be added to a ViewGroup or be part of a layout. It isn’t a subclass of View, however, and can only be added to a ViewGroup using a FragmentTransaction. Like an Activity, a Fragment has a life cycle and implements both the ComponentCallbacks and View.OnCreateCon textMenuListener interfaces. Unlike an Activity, though, a Fragment is not a Context, and its life cycle is dependent on that of the Activity to which it belongs.

Contents:

Creating a Fragment
Fragment Life Cycle
The Fragment Manager
Fragment Transactions
The Support Package
Fragments and Layout


Ebook Preview

If the link above doesn't work, try the link below

Leave a Reply

You can leave a comment to request any article(s), software(s), ebook(s) or report the dead link.
Then I will reply as soon as I can :)

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Recent Post

Recent Posts Widget
Instagram

- Copyright © Madriva -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -