January 2014
Intermediate to advanced
736 pages
70h 43m
English
Class MainActivity (Fig. 6.5) is host for the Cannon Game app’s CannonGameFragment. In this app, we override only Activity method onCreate, which inflates the GUI.
1 // MainActivity.java 2 // MainActivity displays the CannonGameFragment 3 package com.deitel.cannongame; 4 5 import android.app.Activity; 6 import android.os.Bundle; 7 8 public class MainActivity extends Activity 9 {10 // called when the app first launches11 @Override12 public void onCreate(Bundle savedInstanceState)13 {14 super.onCreate(savedInstanceState); // call super's onCreate method15 setContentView(R.layout.activity_main); // inflate the layout16 } ...
Read now
Unlock full access