As you can see, GameView is the screen where the “green ball” moving. GameView will also catch all the user interactions event.
Hence, we cannot let the GameView take responsibility for calculating and drawing the green ball –> We need to create a new Thread to handle it!
Create GameThread class:
Finally, in MainActivity, call setContentView(new GameView(this, null))
Enjoy the result: