What Else Do We Need?

Kotlin and Android Development featuring Jetpack — by Michael Fazio (15 / 125)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Create the App | TOC | Summary and Next Steps 👉

Android Studio added a bunch of files for us to help us get started on the app, but there are a few more things we’d like to add before we try hooking everything up. Here’s what we still need:

  • Fragment classes that we’re using for our views.
  • A menu to tell the bottom nav which options to display.
  • A navigation graph to tell the MainActivity which view to display.
  • Images for the bottom navigation.
  • Updates to MainActivity to bring everything together.

Fragment Classes

While the MainActivity is going to be the entry point for our app, we’re actually only going to be using that single Activity for our app. For any experienced Android developers used to large, heavy Activity classes doing everything, this may seem odd.

However, having one Activity and swapping out Fragment views inside of it is more efficient and now the recommended approach from Google. Plus, as we’ll see in the next chapter, this makes sharing data between views much smoother.

For now, we’re going to create two Fragment classes: PickPlayersFragment and GameFragment. These Fragment classes will eventually be used to set up the players for a game and then play the…

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.