When you need to communicate between activities you can use the startActivityForResult() or maybe you share a globally accessible business logic object between them. As you navigate in the application there is an activity back stack maintained by the OS.Ī simple example is shown in the diagram below:Īctivity A1 is the entry point in our application (for example, it represents a splash screen or a main menu) and from it the user can navigate to A2 or A3. World of ActivitiesĪ typical Android application which uses only activities is organized into a tree-like structure (more precisely into a directed graph) where the root activity is started by the launcher. A demo application implementing this pattern has been uploaded to GitHub. In this article we will look at some common navigation pattern implementations in Android, and then introduce the Fragment based navigation pattern, comparing and contrasting with the others. This approach not only simplifies how the navigation is implemented, but it has much better performance and consequently offers a better user experience. One of my favorite navigation pattern implementations is based on the “One-Activity-Multiple-Fragments” philosophy, or simply the Fragment Navigation Pattern, where every screen in the application is a full screen Fragment and all or most of these fragments are contained in one Activity. Some of the apps were using only Activities, while others Activities mixed with Fragments and/or with Custom Views. Over the years, I’ve seen many different navigation pattern implementations in Android.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |