Learning Java by Building Android Games
上QQ阅读APP看书,第一时间看更新

Chapter 2. Getting Started with Android

In this chapter, we will take a roller coaster ride through all the Android topics that you need to learn in order to get started with Java. It won't just be theoretical though. We will be designing a user interface (UI) of a game menu and we will see and edit our first Java code as well.

In addition, we will see how we can run our apps in either an Android emulator on our PC/Mac or on a real Android device if we have one.

Some of what we will cover in this chapter will be the tip of the iceberg. That is, there is a lot more below the surface to some of the topics we discuss than would be appropriate for the second chapter of a learning Java book. Sometimes, we might need to take a bit of information on faith.

This will then enable us to actually design and run our very own Android app by the end of this chapter. Then we can start learning Java for real at the beginning of the next chapter.

If this chapter seems a little tough, then don't worry; keep going because each subsequent chapter lifts the lid a bit more from some of the less clear topics.

For this chapter and the next two, we will be building a math game. We will start simply and by the end of Chapter 4, Discovering Loops and Methods, we will scale to game features that use significant Java skills.

In this chapter, we will:

  • Start our first game project
  • Explore Android Studio
  • Use the Android Studio visual designer to make our game UI
  • Learn about structuring our code for Android
  • Take our first look at some Java code
  • Build and install our game on an emulator and a real device