Wiring Up Game Logic

The Been There, Done That! application has an open-ended set of trivia questions. Therefore, you cannot save all the questions as resources but instead need to develop a simple way to get new questions on-the-fly. Also, by storing the complete set of trivia questions in a remote location, you streamline the application on the handset, saving disk space.

In the final version of the application, you will be retrieving new batches of questions from the Internet. For now, though, you can retrieve several batches of questions from local XML files. The application can keep a working set of questions in memory, and new batches of questions can be loaded as required. To implement the game logic for the game screen, follow these steps:

1. Update SharedPreferences with game state settings.

2. Handle the retrieval and parsing batches of trivia questions (XML) into a relevant data structure.

3. Implement Button click handling to drive the ImageSwitcher and TextSwitcher updates as well as the game logic.

4. Handle edge cases, such as when no more questions are available. The following sections describe these steps in more detail.

Was this article helpful?

0 0

Post a comment