Tic Tac Toe is one of the oldest and most popular games known to mankind. Its simplicity, ease of play, and competitive nature make it a timeless classic for all age groups. With the advent of mobile technology, playing Tic Tac Toe on your smartphone or tablet has become more accessible than ever. In this article, we’ll explore the features of the Tic Tac Toe APK, how it enhances your gaming experience, and how you can download it for free from APKModDownloads.
1. Introduction to Tic Tac Toe APK
Tic Tac Toe, also known as Noughts and Crosses, is a simple 2-player game played on a 3×3 grid. The goal is to get three of your marks (either X or O) in a row, column, or diagonal before your opponent does. Although the game seems simple, it involves strategy and quick thinking, especially when competing against someone with a similar skill level.
The Tic Tac Toe APK brings this classic game to Android devices, allowing you to play the game anytime, anywhere, without needing a pen and paper. With enhanced graphics, smoother gameplay, and various features, this APK makes the experience even more enjoyable. Download the Tic Tac Toe APK from APKModDownloads to unlock exciting features and start playing today!
2. Features of the Tic Tac Toe APK
The Tic Tac Toe APK is packed with features that make it an exciting and engaging experience for both casual and competitive players. Here are some of the key features:
2.1 User-Friendly Interface
The APK provides an intuitive, clean, and user-friendly interface, ensuring that players can easily navigate through the game. The grid is easy to understand, and the controls are straightforward, making it ideal for players of all ages.
2.2 Single Player and Multiplayer Modes
Whether you want to play alone or challenge your friends, the Tic Tac Toe APK offers both single-player and multiplayer modes. In single-player mode, you can compete against a challenging AI that adjusts its difficulty level according to your skill. Multiplayer mode allows you to play with friends, either locally or online.
2.3 Customizable Themes
Personalize your gaming experience by choosing from a variety of themes and skins. Whether you prefer a simple look or something more vibrant, the Tic Tac Toe APK offers a range of themes to match your style.
2.4 Score Tracking and Leaderboards
Competing against friends or the AI is fun, but it’s even better when you can track your progress. The Tic Tac Toe APK includes score tracking and leaderboards, so you can monitor your victories and challenges and see how you stack up against others.
2.5 Offline Playability
The Tic Tac Toe APK doesn’t require an internet connection for you to play. Whether you’re on a plane, in a car, or anywhere without Wi-Fi, you can still enjoy the game without interruptions.
3. How to Download and Install the Tic Tac Toe APK
Downloading and installing the Tic Tac Toe APK is simple. Just follow these steps to start playing:
Step 1: Visit APKModDownloads
Head to APKModDownloads, where you can find the latest version of the Tic Tac Toe APK. The site is a trusted platform for downloading APKs, ensuring that you get secure and up-to-date files.
Step 2: Download the APK
Once you’re on the website, search for Tic Tac Toe APK and click on the download link. The download will begin automatically.
Step 3: Allow Installation from Unknown Sources
Before installing the APK, you may need to enable installation from unknown sources on your Android device. To do this:
- Go to Settings > Security.
- Toggle the option for Install unknown apps.
- Select the browser you are using and allow it to install APKs.
Step 4: Install the APK
Once the download is complete, locate the file in your device’s download folder. Tap on the file to begin installation. After the installation is complete, you can open the app and start playing Tic Tac Toe on your Android device.
4. Why Choose Tic Tac Toe APK from APKModDownloads?
While there are many places to download Tic Tac Toe APKs, APKModDownloads is the best choice for several reasons:
4.1 Safe and Secure Downloads
APKModDownloads is committed to providing secure and verified APK files. Every download is scanned for malware and other threats, ensuring that you can enjoy your game without worrying about security issues.
4.2 Regular Updates
The website ensures that the APKs hosted on the platform are always up-to-date. You will always get the latest version of the Tic Tac Toe APK, complete with new features, bug fixes, and performance improvements.
4.3 Free of Cost
Unlike many other websites that charge for APK downloads, APKModDownloads offers the Tic Tac Toe APK for free. This means you can enjoy the game without having to pay for it, which is great for budget-conscious players.
4.4 Easy Navigation
The website is designed to be simple and easy to navigate, ensuring that you can quickly find and download the game. Whether you’re a first-time visitor or a regular user, you’ll have no trouble accessing the game you want.
5. Tips for Winning at Tic Tac Toe
While Tic Tac Toe is a game of strategy and logic, there are some tips you can use to improve your chances of winning:
5.1 Take the Center Square
If you’re playing first, always start in the center. This position gives you the most opportunities to create multiple lines of three, making it easier to win.
5.2 Block Your Opponent
If your opponent is one move away from winning, make sure to block them. The key to success in Tic Tac Toe is both attacking and defending simultaneously.
5.3 Try to Create Multiple Winning Lines
Don’t focus on just one line. Always try to create multiple opportunities for winning. By doing this, you force your opponent to block one line while you complete another.
5.4 Practice Makes Perfect
The more you play, the better you’ll become. Use the single-player mode to practice your strategy and improve your skills.
Conclusion
Tic Tac Toe APK brings this classic game to your Android device, offering a fun and challenging experience whether you’re playing alone or with friends. Download it today from APKModDownloads for the best version of this timeless game, complete with exciting features like customizable themes, multiplayer mode, and offline playability.
Don’t forget to visit APKModDownloads for more free APK downloads and enjoy a variety of games and apps on your Android device!
Source Code (Android Studio)
Step-by-Step Implementation
Step 1: Open Android Studio, Create New Project, Choose Empty Activity and name the project “TicTacToe”.

Step 2: AndroidMainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.TicTacToe"
tools:targetApi="31">
<activity
android:name=".ResultDialog"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="false" />
<activity
android:name=".AddPlayers"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-2461177337350544~7598627331"/>
</application>
</manifest>
Step 3: AddPlayers.java
Make it launcher activity
package com.example.tictactoe;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class AddPlayers extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_players);
EditText playerOne = findViewById(R.id.playerOne);
EditText playerTwo = findViewById(R.id.playerTwo);
Button startGameButton = findViewById(R.id.startGameButton);
startGameButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String getPlayerOneName = playerOne.getText().toString();
String getPlayerTwoName = playerTwo.getText().toString();
if (getPlayerOneName.isEmpty() || getPlayerTwoName.isEmpty()) {
Toast.makeText(AddPlayers.this, "Please enter player name", Toast.LENGTH_SHORT).show();
} else {
Intent intent = new Intent(AddPlayers.this, MainActivity.class);
intent.putExtra("playerOne", getPlayerOneName);
intent.putExtra("playerTwo", getPlayerTwoName);
startActivity(intent);
}
}
});
}
}
Step 4: MainActivity.java
package com.example.tictactoe;
import static android.content.ContentValues.TAG;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.tictactoe.databinding.ActivityMainBinding;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.interstitial.InterstitialAd;
import com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback;
import com.google.android.gms.ads.LoadAdError;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private ActivityMainBinding binding;
private final List<int[]> combinationList = new ArrayList<>();
private int[] boxPositions = new int[9]; // Default values are 0
private int playerTurn = 1;
private int totalSelectedBoxes = 1;
private int playCount = 0; // Tracks the total number of games played
private AdView mAdView; // Banner AdView
private InterstitialAd mInterstitialAd; // Interstitial Ad
private TextView playCounter; // TextView to display the number of plays
private Button restartButton; // Button for restarting the match
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
// Initialize AdMob
MobileAds.initialize(this, initializationStatus -> {});
// Setup Banner Ads
mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
AdView adView2 = findViewById(R.id.adView2);
adView2.loadAd(adRequest);
// Load Interstitial Ad
loadInterstitialAd();
// Initialize UI components
playCounter = findViewById(R.id.playCounter);
restartButton = findViewById(R.id.click_btn);
// Set OnClickListener for restart button
restartButton.setOnClickListener(v -> {
if (mInterstitialAd != null) {
mInterstitialAd.show(MainActivity.this);
} else {
Log.d(TAG, "Interstitial ad not loaded yet.");
}
restartMatch();
});
// Initialize the game
initializeGame();
}
private void loadInterstitialAd() {
AdRequest adRequest = new AdRequest.Builder().build();
InterstitialAd.load(this, "ca-app-pub-2461177337350544/9508774683", adRequest,
new InterstitialAdLoadCallback() {
@Override
public void onAdLoaded(InterstitialAd interstitialAd) {
mInterstitialAd = interstitialAd;
Log.d(TAG, "Interstitial ad loaded.");
}
@Override
public void onAdFailedToLoad(LoadAdError loadAdError) {
mInterstitialAd = null;
Log.d(TAG, "Failed to load interstitial ad: " + loadAdError.getMessage());
}
});
}
private void initializeGame() {
combinationList.add(new int[]{0, 1, 2});
combinationList.add(new int[]{3, 4, 5});
combinationList.add(new int[]{6, 7, 8});
combinationList.add(new int[]{0, 3, 6});
combinationList.add(new int[]{1, 4, 7});
combinationList.add(new int[]{2, 5, 8});
combinationList.add(new int[]{2, 4, 6});
combinationList.add(new int[]{0, 4, 8});
String getPlayerOneName = getIntent().getStringExtra("playerOne");
String getPlayerTwoName = getIntent().getStringExtra("playerTwo");
binding.playerOneName.setText(getPlayerOneName);
binding.playerTwoName.setText(getPlayerTwoName);
setupGameBoard();
}
private void setupGameBoard() {
binding.image1.setOnClickListener(view -> performAction((ImageView) view, 0));
binding.image2.setOnClickListener(view -> performAction((ImageView) view, 1));
binding.image3.setOnClickListener(view -> performAction((ImageView) view, 2));
binding.image4.setOnClickListener(view -> performAction((ImageView) view, 3));
binding.image5.setOnClickListener(view -> performAction((ImageView) view, 4));
binding.image6.setOnClickListener(view -> performAction((ImageView) view, 5));
binding.image7.setOnClickListener(view -> performAction((ImageView) view, 6));
binding.image8.setOnClickListener(view -> performAction((ImageView) view, 7));
binding.image9.setOnClickListener(view -> performAction((ImageView) view, 8));
}
private void performAction(ImageView imageView, int selectedBoxPosition) {
if (!isBoxSelectable(selectedBoxPosition)) return;
boxPositions[selectedBoxPosition] = playerTurn;
if (playerTurn == 1) {
imageView.setImageResource(R.drawable.ximage);
} else {
imageView.setImageResource(R.drawable.oimage);
}
handleGameResult();
}
private void handleGameResult() {
if (checkResults()) {
String winner = (playerTurn == 1) ? binding.playerOneName.getText().toString() : binding.playerTwoName.getText().toString();
showResultDialog(winner + " is the Winner!");
} else if (totalSelectedBoxes == 9) {
showResultDialog("Match Draw");
} else {
totalSelectedBoxes++;
changePlayerTurn(playerTurn == 1 ? 2 : 1);
}
}
private void showResultDialog(String message) {
ResultDialog resultDialog = new ResultDialog(MainActivity.this, message, this);
resultDialog.setCancelable(false);
resultDialog.show();
showInterstitialAd();
// Update play counter after game ends
playCount++;
updatePlayCounter();
}
private void updatePlayCounter() {
playCounter.setText("Plays: " + playCount);
}
private void changePlayerTurn(int currentPlayerTurn) {
playerTurn = currentPlayerTurn;
if (playerTurn == 1) {
binding.playerOneLayout.setBackgroundResource(R.drawable.black_border);
binding.playerTwoLayout.setBackgroundResource(R.drawable.white_box);
} else {
binding.playerTwoLayout.setBackgroundResource(R.drawable.black_border);
binding.playerOneLayout.setBackgroundResource(R.drawable.white_box);
}
}
private boolean checkResults() {
for (int[] combination : combinationList) {
if (boxPositions[combination[0]] == playerTurn &&
boxPositions[combination[1]] == playerTurn &&
boxPositions[combination[2]] == playerTurn) {
return true;
}
}
return false;
}
private boolean isBoxSelectable(int boxPosition) {
return boxPositions[boxPosition] == 0;
}
public void restartMatch() {
boxPositions = new int[9]; // Reset board positions
playerTurn = 1;
totalSelectedBoxes = 1;
binding.image1.setImageResource(R.drawable.white_box);
binding.image2.setImageResource(R.drawable.white_box);
binding.image3.setImageResource(R.drawable.white_box);
binding.image4.setImageResource(R.drawable.white_box);
binding.image5.setImageResource(R.drawable.white_box);
binding.image6.setImageResource(R.drawable.white_box);
binding.image7.setImageResource(R.drawable.white_box);
binding.image8.setImageResource(R.drawable.white_box);
binding.image9.setImageResource(R.drawable.white_box);
loadInterstitialAd();
}
private void showInterstitialAd() {
if (mInterstitialAd != null) {
mInterstitialAd.show(this);
}
}
}
Step 5: ResultDialog.java
package com.example.tictactoe;
import androidx.annotation.NonNull;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class ResultDialog extends Dialog {
private final String message;
private final MainActivity mainActivity;
// Default constructor
public ResultDialog(@NonNull Context context) {
super(context);
this.message = "";
this.mainActivity = null;
}
// Constructor with parameters (the one you're using)
public ResultDialog(@NonNull Context context, String message, MainActivity mainActivity) {
super(context);
this.message = message;
this.mainActivity = mainActivity;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_result_dialog);
TextView messageText = findViewById(R.id.messageText);
Button startAgainButton = findViewById(R.id.startAgainButton);
messageText.setText(message);
startAgainButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mainActivity != null) {
mainActivity.restartMatch(); // Call restart match in MainActivity
}
dismiss();
}
});
}
}
Now Go To Drawable Folder and Add this below files with proper code
Step 6: black_border.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@color/white"/>
<corners
android:radius="30dp"/>
<stroke
android:color="@color/black"
android:width="2dp"/>
</shape>
Step 7: lavender_border.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dp"
android:color="@color/lavender"/>
<corners
android:radius="30dp"/>
</shape>
Step 8: white_box.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@color/white"/>
<corners
android:radius="30dp"/>
</shape>
Step 9: Download Below Image
Assets unzip the files and select all the image once and page into "Drawable" Folder In Android Studio
Step 10: activity_add_players.xml
Note: Add this files in Layout Section
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:background="@drawable/pagebkg"
tools:context=".AddPlayers">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="30dp"
app:cardCornerRadius="30dp"
app:cardElevation="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center_horizontal"
android:padding="24dp"
android:background="@drawable/lavender_border">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ENTER \n PLAYERS NAMES"
android:textAlignment="center"
android:textSize="36sp"
android:textStyle="bold"
android:textColor="@color/lavender"/>
<EditText
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/playerOne"
android:background="@drawable/lavender_border"
android:layout_marginTop="40dp"
android:padding="8dp"
android:maxLines="1"
android:textStyle="italic"
android:hint="Enter player one name"
android:textColor="@color/lavender"
android:drawableLeft="@drawable/ic_xicon"
android:drawablePadding="8dp"/>
<EditText
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/playerTwo"
android:background="@drawable/lavender_border"
android:layout_marginTop="20dp"
android:padding="8dp"
android:maxLines="1"
android:textStyle="italic"
android:hint="Enter player two name"
android:textColor="@color/lavender"
android:drawableLeft="@drawable/ic_oicon"
android:drawablePadding="8dp"/>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="30dp"
android:id="@+id/startGameButton"
android:text="Start Game"
android:textSize="18sp"
app:cornerRadius = "20dp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
Step 11: activity_result_dialog.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ResultDialog">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/lavender"
android:orientation="vertical">
<TextView
android:id="@+id/messageText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Results"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginTop="20dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"/>
<Button
android:id="@+id/startAgainButton"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="Start Again"
android:textColor="@color/lavender"
android:textSize="18sp"
android:textStyle="bold"
android:backgroundTint="@color/white"
android:layout_margin="20dp"
app:cornerRadius="20dp"/>
</LinearLayout>
</RelativeLayout>
Step 12: activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/lavender"
tools:context=".MainActivity"
tools:ignore="ExtraText">
<Button
android:id="@+id/click_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me to get interstial ad"
android:layout_centerInParent="true"
android:visibility="gone"/>
<TextView
android:id="@+id/playCounter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:text="Plays: 0"
android:textSize="25sp"
android:textColor="@android:color/white"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_above="@id/container"
android:layout_alignParentTop="true"
android:layout_marginTop="50dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="120dp"
android:layout_height="wrap_content"
android:id="@+id/playerOneLayout"
android:orientation="vertical"
android:layout_marginTop="20dp"
android:gravity="center"
android:background="@drawable/white_box">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Player One"
android:id="@+id/playerOneName"
android:textSize="20sp"
android:gravity="center"
android:textStyle="bold"
android:textColor="@color/lavender"
android:maxLines="1"/>
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/ximage"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:id="@+id/playerTwoLayout"
android:layout_marginTop="20dp"
android:orientation="vertical"
android:gravity="center"
android:background="@drawable/white_box">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Player Two"
android:id="@+id/playerTwoName"
android:textSize="20sp"
android:gravity="center"
android:textStyle="bold"
android:textColor="@color/lavender"
android:maxLines="1"/>
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/oimage"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_gravity="center"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/container"
android:layout_alignParentBottom="true"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="50dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="20dp"
android:weightSum="3">
<ImageView
android:layout_width="0dp"
android:layout_height="115dp"
android:id="@+id/image1"
android:layout_weight="1"
android:background="@drawable/white_box"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="10dp"
android:adjustViewBounds="true"
android:padding="20dp"/>
<ImageView
android:layout_width="0dp"
android:layout_height="115dp"
android:id="@+id/image2"
android:layout_weight="1"
android:background="@drawable/white_box"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="10dp"
android:adjustViewBounds="true"
android:padding="20dp"/>
<ImageView
android:layout_width="0dp"
android:layout_height="115dp"
android:id="@+id/image3"
android:layout_weight="1"
android:background="@drawable/white_box"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="10dp"
android:adjustViewBounds="true"
android:padding="20dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="20dp"
android:weightSum="3">
<ImageView
android:layout_width="0dp"
android:layout_height="115dp"
android:id="@+id/image4"
android:layout_weight="1"
android:background="@drawable/white_box"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="10dp"
android:adjustViewBounds="true"
android:padding="20dp"/>
<ImageView
android:layout_width="0dp"
android:layout_height="115dp"
android:id="@+id/image5"
android:layout_weight="1"
android:background="@drawable/white_box"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="10dp"
android:adjustViewBounds="true"
android:padding="20dp"/>
<ImageView
android:layout_width="0dp"
android:layout_height="115dp"
android:id="@+id/image6"
android:layout_weight="1"
android:background="@drawable/white_box"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="10dp"
android:adjustViewBounds="true"
android:padding="20dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="20dp"
android:weightSum="3">
<ImageView
android:layout_width="0dp"
android:layout_height="115dp"
android:id="@+id/image7"
android:layout_weight="1"
android:background="@drawable/white_box"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="10dp"
android:adjustViewBounds="true"
android:padding="20dp"/>
<ImageView
android:layout_width="0dp"
android:layout_height="115dp"
android:id="@+id/image8"
android:layout_weight="1"
android:adjustViewBounds="true"
android:background="@drawable/white_box"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="10dp"
android:padding="20dp"/>
<ImageView
android:layout_width="0dp"
android:layout_height="115dp"
android:id="@+id/image9"
android:layout_weight="1"
android:background="@drawable/white_box"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="10dp"
android:padding="20dp"
android:adjustViewBounds="true"/>
</LinearLayout>
</LinearLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:adSize="BANNER"
app:adUnitId="ca-app-pub-2461177337350544/5425358742"/>
<com.google.android.gms.ads.AdView
android:id="@+id/adView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:adSize="BANNER"
app:adUnitId="ca-app-pub-2461177337350544/5425358742"/>
</RelativeLayout>
Step 13: colors.xml
Now go to colours folder add update Or add below code
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="lavender">#8692f7</color>
</resources>
Step 14: strings.xml
<resources>
<!-- Your other string resources -->
<string name="app_name">Tic Tac Toe</string>
<string name="admob_banner_ad_unit_id">ca-app-pub-2461177337350544/5425358742</string>
</resources>
Step 15: themes.xml
Now Update The Theme Folder With Below Codes
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.TicTacToe" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
Step 16: themes.xml (night)
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.TicTacToe" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
Step 17: build.gradle.kts
plugins {
alias(libs.plugins.android.application)
}
android {
namespace = "com.example.tictactoe"
compileSdk = 34
defaultConfig {
applicationId = "com.example.tictactoe"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
buildFeatures {
viewBinding = true // Fixed syntax
}
}
dependencies {
implementation(libs.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
implementation("com.google.android.gms:play-services-ads:21.5.0")
}
Step 18: Add Icon
Download Below image and add into: Drawable > ic_launcher_background.xml > New > Image Asset
Full Video Tutorial To Create App Watch Below Video: