O'Reilly logo

Android™ How to Program, Second Edition by Abbey Deitel, Harvey Deitel, Paul Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.5.4. Overriding Activity Method onCreate

The onCreate method (Fig. 4.20) is called by the system:

• when the app loads

• if the app’s process was killed by the operating system while the app was in the background, and the app is then restored

• each time the configuration changes, such as when the user rotates the device or opens or closes a physical keyboard.

39      // called when MainActivity is first created40      @Override41      protected void onCreate(Bundle savedInstanceState)42      {43         super.onCreate(savedInstanceState);44         setContentView(R.layout.activity_main);45 46         // get references to the EditTexts47         queryEditText = (EditText) findViewById(R.id.queryEditText);48         tagEditText ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required