Now that we have the layouts of the main screen and fragment, we need to write a little Java code to make them appear. We’ll start with the app’s main program: the MainActivity class.
You should already have a file called MainActivity.java in the org.example.tictactoe package under the java folder. It was created by Android Studio when we created the project. Open it now by double-clicking it in the Project window, by selecting the Navigate > File menu option, or by pressing the keyboard shortcut (Ctrl+Shift+N on Windows) and typing the filename. Then replace all the code with the following:
package org.example.tictactoe; ...