xref: /aosp_15_r20/development/samples/TicTacToeLib/_index.html (revision 90c8c64db3049935a07c6143d7fd006e26f8ecca)
1*90c8c64dSAndroid Build Coastguard Worker<p>This application is an example of an Android library project, a type of
2*90c8c64dSAndroid Build Coastguard Workerproject that lets you store and manage shared code and resources in one place,
3*90c8c64dSAndroid Build Coastguard Workerthen make them available to your other Android applications. </p>
4*90c8c64dSAndroid Build Coastguard Worker
5*90c8c64dSAndroid Build Coastguard Worker<p>The TicTacToeLib library project is designed to provide a game-play Activity,
6*90c8c64dSAndroid Build Coastguard Worker<code>GameActivity</code> to other applications. Dependent applications simply
7*90c8c64dSAndroid Build Coastguard Workerlaunch the Activity using an explicit intent &mdash; once launched,
8*90c8c64dSAndroid Build Coastguard Worker<code>GameActivity</code> assumes control of the application lifecycle and
9*90c8c64dSAndroid Build Coastguard Workerhandles all events and UI interactions.</p>
10*90c8c64dSAndroid Build Coastguard Worker
11*90c8c64dSAndroid Build Coastguard Worker<ul>
12*90c8c64dSAndroid Build Coastguard Worker<li>The library project includes an <a
13*90c8c64dSAndroid Build Coastguard Workerhref="AndroidManifest.html">AndroidManifest.xml</a> file that
14*90c8c64dSAndroid Build Coastguard Workerdeclares <code>GameActivity</code>.</li>
15*90c8c64dSAndroid Build Coastguard Worker<li><a
16*90c8c64dSAndroid Build Coastguard Workerhref="src/com/example/android/tictactoe/library/GameActivity.html">GameActivity.java</a>
17*90c8c64dSAndroid Build Coastguard Workerhandles most of the application lifecycle and manages general game play.</li>
18*90c8c64dSAndroid Build Coastguard Worker<li><a
19*90c8c64dSAndroid Build Coastguard Workerhref="src/com/example/android/tictactoe/library/GameView.html">GameView.java</a>
20*90c8c64dSAndroid Build Coastguard Workerrenders the UI of the game and manages interaction events during game play.</li>
21*90c8c64dSAndroid Build Coastguard Worker</ul>
22*90c8c64dSAndroid Build Coastguard Worker
23*90c8c64dSAndroid Build Coastguard Worker<p>If you want to build the TicTacToeLib application, you can obtain it by
24*90c8c64dSAndroid Build Coastguard Workerdownloading the "Samples for SDK API 8" component (or higher version) into your
25*90c8c64dSAndroid Build Coastguard WorkerSDK, using the <em>Android SDK and AVD Manager</em>. </p>
26*90c8c64dSAndroid Build Coastguard Worker
27*90c8c64dSAndroid Build Coastguard Worker<p>Note that you can not build and run TicTacToeLib independently, since it is a
28*90c8c64dSAndroid Build Coastguard Workerlibrary project and not a true Android application project. To run it, you need
29*90c8c64dSAndroid Build Coastguard Workerto build the application that uses the library project &mdash; in this case, the
30*90c8c64dSAndroid Build Coastguard Worker<a href="../TicTacToeMain/index.html">TicTacToeMain</a> application, which is also included in the Samples
31*90c8c64dSAndroid Build Coastguard WorkerSDK comnponent. </p>
32*90c8c64dSAndroid Build Coastguard Worker
33*90c8c64dSAndroid Build Coastguard Worker<p>To build an application that uses a library project, you also need to update
34*90c8c64dSAndroid Build Coastguard Workerto the latest version of the SDK tools (r6 or higher) and Android platforms, as
35*90c8c64dSAndroid Build Coastguard Workerwell as the latest version of ADT (0.9.7 or higher), if you are developing in
36*90c8c64dSAndroid Build Coastguard WorkerEclipse. </p>
37*90c8c64dSAndroid Build Coastguard Worker
38*90c8c64dSAndroid Build Coastguard Worker<p>For information about how to set up Android library projects, refer to
39*90c8c64dSAndroid Build Coastguard Worker<a href="../../../guide/developing/eclipse-adt.html#libraryProject">Developing
40*90c8c64dSAndroid Build Coastguard Workerin Eclipse with ADT</a> or <a
41*90c8c64dSAndroid Build Coastguard Workerhref="../../../guide/developing/other-ide.html#libraryProject">Developing in
42*90c8c64dSAndroid Build Coastguard WorkerOther IDEs</a>, depending on your environment.</p>