O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

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

Coding App Behavior

Code to give behavior to the layout is written and stored in the Java class file associated with the layout. Open the HelloWorldActivity.java file by double-clicking it. If it is already open, click its tab in the editor. You should see the basic code structure (Listing 3.4).

Listing 3.4 Initial Activity Code

                                                                      //1package com.example.helloworld;                                                                      //2import android.os.Bundle;import android.app.Activity;import android.view.Menu;                                                                      //3public class HelloWorldActivity extends Activity {    @Override ...

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