# Android Activities and Fragments: Responsibilities and Design Challenges

DevFeed: [Android Activities and Fragments: Responsibilities and Design Challenges](<https://devfeed.tech/articles/everything-that-s-wrong-with-android-s-activities-26002.md>)

Original publisher: [Read original article](<https://medium.com/@nhaarman/everything-thats-wrong-with-android-s-activities-ee784a84d775?source=rss-fceb7a60a849------2>)

Author: Niek Haarman

Published: 2018-08-27T19:38:46Z

Content type: article

Language: en

Sources: [Stories by Niek Haarman on Medium](<https://devfeed.tech/sources/stories-by-niek-haarman-on-medium.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [App](<https://devfeed.tech/topics/app.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [navigation](<https://devfeed.tech/topics/navigation.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [applications](<https://devfeed.tech/tags/applications.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [lifecycle](<https://devfeed.tech/tags/lifecycle.md>), [memory](<https://devfeed.tech/tags/memory.md>), [multitasking](<https://devfeed.tech/tags/multitasking.md>), [navigation](<https://devfeed.tech/tags/navigation.md>), [permissions](<https://devfeed.tech/tags/permissions.md>)

## AI overview

The article examines the many responsibilities of Android Activities, including serving as application entry points, hosting user interfaces, managing lifecycles and state restoration, handling configuration changes, navigation, permissions, menus, and toolbars. It presents these responsibilities as valid use cases while highlighting the resulting design challenges.

## Source excerpt

..and Fragments, for that matter. Let's just kick off and have a look at what an Activity is capable of: 1. The Activity is an entry point The Activity is an entry point into your application that the user sees when they open your application. Upon clicking your application icon from a launcher app, an Activity instance is created and presented to the user. 2. The Activity hosts the window that interacts with the user. By calling setContentView in your Activity, you can inflate a layout that is bound to a Window instance hosted by the Activity. This allows the user to see and interact with your application. 3. The Activity has a lifecycle Android's multitasking mechanism allows for applications to be put in the background temporarily, and navigated back to when the user sees fit. To be able to react to these events, the Activity provides a set of callbacks you can implement. 4. The Activity needs state restoration Android's multitasking mechanism combined with limited memory can cause applications to be killed. To prevent a bad user experience when the user loses a message he or she was typing due to this, the Activity allows its state to be saved to a bundle. 5. An Activity can have a result Applications can start other applications to request a particular result. For example, the Contacts app can be launched to select a particular contact. When this is done, the result is sent back to the original application that started the request. Now these are all very valid use cases. They make up the foundation of all applications, and allow for perfectly fine applications to be created. But wait, there's more! 6. The Activity is destroyed on configuration changes When a device configuration changes, such as an orientation change or when the system local has changed, the Activity is destroyed and recreated with a new Resources set for the new configuration. 7. The Activity handles navigation When a user clicks an item in an item list Activity, the Activity can start a new A