
Learning Java by Building Android Games
By :

As we did for the Sub Hunter project, find the following line of code near the top of the PongActivity.java
file:
import androidx.appcompat.app.AppCompatActivity;
Change the preceding line of code to the same as this next line of code:
import android.app.Activity;
Immediately after the preceding line of code, add this new line of code:
import android.view.Window;
The line of code we changed enables us to use a more efficient version of the Android API, Activity
instead of AppCompatActivity
, and the new line of code allows us to use the Window
class, which we will do in this section in a moment.
At this point, there are errors in our code. This next step will remove the errors. Find the following line of code in the PongActivity.java
file:
public class PongActivity extends AppCompatActivity {
Change the preceding line of code to the same as this next line of code:
public class PongActivity...