to top
Android APIs
Sample Code >

TicTacToeLib - TicTacToeLib

← Back

This application is an example of an Android library project, a type of project that lets you store and manage shared code and resources in one place, then make them available to your other Android applications.

The TicTacToeLib library project is designed to provide a game-play Activity, GameActivity to other applications. Dependent applications simply launch the Activity using an explicit intent — once launched, GameActivity assumes control of the application lifecycle and handles all events and UI interactions.

  • The library project includes an AndroidManifest.xml file that declares GameActivity.
  • GameActivity.java handles most of the application lifecycle and manages general game play.
  • GameView.java renders the UI of the game and manages interaction events during game play.

If you want to build the TicTacToeLib application, you can obtain it by downloading the "Samples for SDK API 8" component (or higher version) into your SDK, using the Android SDK and AVD Manager.

Note that you can not build and run TicTacToeLib independently, since it is a library project and not a true Android application project. To run it, you need to build the application that uses the library project — in this case, the TicTacToeMain application, which is also included in the Samples SDK comnponent.

To build an application that uses a library project, you also need to update to the latest version of the SDK tools (r6 or higher) and Android platforms, as well as the latest version of ADT (0.9.7 or higher), if you are developing in Eclipse.

For information about how to set up Android library projects, refer to Developing in Eclipse with ADT or Developing in Other IDEs, depending on your environment.

Subdirectories

Files