The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.

The Android User Interface

The project you created in an earlier tutorial was just the default files generated by the Android build tools — you did not write any Java code yourself. In this chapter, we will examine the basic Java code and resources that make up an Android activity.

The Activity

The Java source code that you maintain will be in a standard Java-style tree of directories based upon the Java package you chose when you created the project (e.g., results in com/commonsware/android/). Android Studio will have that source, by default, in app/src/main/java/ off of the top-level project root.

If, in the new-project wizard, you elected to create an activity, you will have, in the innermost directory, a Java source file representing an activity class.

A very simple activity looks like:

package com.commonsware.empublite;

import android.os.Bundle;

public class EmPubLiteActivity extends Activity {

  protected void onCreate(Bundle savedInstanceState) {

Dissecting the Activity

The preview of this section was the victim of a MITM ('Martian in the middle') attack.

Using XML-Based Layouts

The preview of this section was whisked away by a shark-infested tornado.