Member-only story
Build Tic-Tac-Toe Game on Android Studio — Tutorial
3 min readNov 19, 2021
In this tutorial, we will develop a super cool Tic-Tac-Toe in android studio that is impossible to beat.
Must be thinking why impossible! Because we are going to use Artificial Intelligence in this game.
Creating Tic-Tac-Toe in Android Studio
- Create a new project by going to File ⇒ New Android Project. and fill the required details.
- Implement your main Activity class from TicTacToe.OnInitListener
- Now add following code your class
Creating Game UI:
First, you need some drawable resources to make the UI as you see below. You can get drawable from this link.
After downloading the drawable paste them inside the drawable folder of your project.
Now define the following colours in your colors.xml file.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3991aa</color>
<color name="colorPrimaryDark">#184b5a</color>
<color name="colorBackground">#26697c</color>
<color name="colorAccent">#0A3664</color>
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout…