Linking up our methods
So far, we know that we can define methods with code like this:
void draw(){ // Handle all the drawing here }
And we can call/execute methods with code like this:
draw();
We have also alluded to, as well as mentioned in our comments that the onCreate
method (provided automatically by Android) will handle the One-time Setup part of the flowchart.
The reason for this is that all Android games (and the vast majority of other Android apps) must have an Activity
class as the starting point. Activity
is what interacts with the operating system. Without one the operating system cannot run our code. The way that the operating system interacts with and executes our code is through the methods of the Activity
class. There are many methods ...
Get Learning Java by Building Android Games - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.