Single Activity: Why, When, and How (Android Dev Summit '18)

With the Navigation Architecture Component, developers have the tools to move towards a single activity structure for their app, but they don’t know:

— why they should move to that model
— when it is appropriate
— how exactly to take advantage of that structure and migrate to it

Navigation Architecture Component →
Testing Fragments →

Presented by: Ian Lake

Android Dev Summit ’18 all sessions playlist →…


  1. I was really happy to share a lot of the best practices around activities, Fragments, Navigation, and most importantly *making your code testable*. Thanks for watching!

  2. Have been using single activity pattern for a while (4 years or so). Banner ads can perform uninterrupted and register more impressions when a single activity pattern is employed.

  3. What about destroying invisible activities and recreating them when user navigates back to it in order to save memory and resources? Did we stopped to care about that and expect phone manufactures to put more RAM in phones than we used to have in our computers?

  4. Very nice, but what's happens when you have a app where some screens have a navbar or drawer and some screens do not? Can you really do the same with one activity

  5. Dynamic features must be able to add their graphs at build time rather than been hardcoded in base module. If feature is added to the build, the nav graph of that feature gets added to base nav graph. If feature goes away, the feature's nav graph goes away too.

  6. Its good practice to use two navigation(in two deferents activities ) in same app ?
    example : one navigation for (register ,login) and second navigation for (navigation drawer) ?

  7. Great talk! Can we find some sample app to get an idea of how all the pieces fit together? Sometimes I got lost with the code examples so having a little app to experiment with would greatly help me.

  8. For a real world app that has many screens to follow the Single Activity approach, I can think of two possible scenarios.
    First, a single ViewModel is used and shared by all destinations. This single ViewModel is going to be bloated and not scalable. For this reason, I think the first approach is not suitable for real world development.
    Second, multiple ViewModels are used. (Not necessary one ViewModel per destination but would be close.) Given the lifecycle of a ViewModel is tied to the lifecycle of the (single) Activity, how is a "cold" (instantiated by no longer needed) ViewModel going to be released?

  9. If you want people to adopt your proposed practices such as only using documentLaunchMode rather than launchMode then perhaps you could write a consistent set of reference and guidance web pages. The current set are almost impossible to comprehend. Best of all is which features a video presented by you and which completely fails to mention documentLaunchMode. And that page was last updated on 28th August 2018!

  10. Kotlin was the biggest mistake, believe me hybrid mobile application development is way better than kotlin

  11. I'm pretty sure I'm fed up with Android. Been with it since 2009, but I think it's getting to a point where a lot of what I've spent years mastering are getting reworked, and I don't want to go through the struggles of mastering all this new stuff again. Not to mention all the new "gotcha's" that are going to come along with all these new APIs (remember when fragments came along?). Plus, while I'm busy as hell at work, on what do I spend the 30-45 minutes in the day to learn, Kotlin or Flutter?

    You've been good and bad to me, Google. Maybe it's time we spend some time apart.

  12. Ian's videos are always my favourite 'cause he's always passinote and enthusiastic. Keep up the good work, you're amazing. And thanks for the video.

  13. thanks for effort.
    As a feedback:
    As usual, it turned another Google presentation focused nothing. Atleast, as a developer I was expected to hear in depth about navigation.

Leave a Reply

Your email address will not be published. Required fields are marked *