Mastering fragments

Fragments are yet another component that are offered by the Android platform, which can be used inside the Activity that you learned about in Chapter 3, Mastering the Life and Death of Android Apps. Fragments encapsulate behavior, functionality, or even user interface in an easy-to-reuse format. Also, fragments have their own life cycle so many of them can be combined in the same activity and they can communicate with each other very much like Intents do (which is described in Chapter 8, Mastering Intents – A Walkthrough).

In this recipe, we will see how to use two different fragments in the same activity.

Getting ready

Create a new solution named Fragment_Project and open the project of the same name that Xamarin Studio has created ...

Get Xamarin Studio for Android Programming: A C# Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.