The wonderful world of Android

The Android experience revolves around the design of a beautiful UI that users find intuitive, easy to use and navigate through, and simple. The design of a great looking UI is an art and requires exceptionally good UI design skills. We will not teach that in this class but we will gain skills of putting together a nice, clean and simple UI.

What this lecture will teach you:

Standard UI Screens

There are many parts of the UI that you are already using; that is the home, all apps and recent app screens.

Home screen

When you unlock the phone or touch the home button on the navigation bar you will be directed to the home screen, as shown below. Above the system bar you can see the the favorites tray with various icons of your favorite apps (e.g., phone, mail, all apps button, messaging and web).

All app screen

If you touch on the all apps button (circled above) in the favorite tray on the home screen you will come to the all apps screen. Users can swipe through multiple app and widget screens and drag and drop items to customize the all app screens.

Recent apps screen

Apps that have been used and are currently stopped can be viewed by touching the recent app button on the navigation bar, as circled in the screen above. You can switch back to an app that you have previously used by simply touching it. Note that applications are stacked in reverse chronological order with the most recently used app at the bottom.

Status bar and notification screen

As denoted in the screen above, the status bar displays notifications on the left and status on the right. Status includes time, battery, cell signal strength, bluetooth enabled. Notifications on the right show wifi, mail, bewell, voicemail, usb active, music. The phone informs me that there is stuff for me to look at -- mail to read, voicemail, etc. These are pending notification of events that the user should take a peek at.

If you drag or swipe down the status bar it provides a whole lot more information on these notifications -- they are expanded from the simple icons in the status bar. Some of the notifications can be dismissed by a swipe, others cannot. We will use the status bar to notify the user of events in the code we write in this course. In the following screenshot, you can see that the expanded notification shade tells me my phone is in low battery, there is a screenshot I recently took, and that the BeWell app is currently running in the background. If I click the circled clear button, the phone will dismiss all the notifications that are dismissible.

If you drag the notification shade further down, you will see a menu with many quick toggle buttons to change settings. You can also adjust the screen light here.

Facebook UI

Android allows you to design UIs using graphical tools and xml. It also provides a number of widgets and standard layouts for the design of simple clean UIs. Here is an example that shows some standard UI components that you will use.

Consider the Facebook app. It uses the action bar -- in fact it uses a split action bar with a main action bar -- as shown in the figure below. When the page is running on a narrow screen and you have a lot of action items to load, you can use a split action bar at the bottom of the screen. You are use to using this navigation scheme as a Facebook user.

Action bar

A quick note on the action bar. The action bar is configurable from app to app and provides a semi-standard way to build out a simple and clean app UI to handle user action and app navigation.

The action bar provides a common and consistent interface for Android users. It can be used and adapted by many apps. We will show the email app below. We will use action bars and the ActionBar APIs to set up some clean UIs.

Gmail UI

The second app is the gmail UI --shown below. This time the main action bar is a lot simpler, with a hamburger icon to the left serving as a navigation drawer. Many actions are hidden there.

This allows users to switch between different views of the gmail such as the outbox, recent, drafts, sent, started and show all labels. Check it out on your phone.

App development cycle

As coders you are aware of the development cycle of any software but the unique part of Android is the publishing part -- see the development cycle below.

Some factoids on Androids

What's in an app: application components

When you develop apps you will be using five key building blocks -- some apps may have all these components and others not -- really depends on what type of app you are planning on building:

MyRuns comprises many activities. We will implement a number of activities. An activity you create is implemented as a subclass of Activity.

Some of the MyRuns activities that deal with the UI have a number of fragments -- we will implement a lot of fragments. A fragment you create is implemented as a subclass of Fragment.

A service you create is implemented as a subclass of Service.

A content provider is implemented as a subclass of ContentProvider.

A broadcast receiver is implemented as a subclass of BroadcastReceiver and each broadcast is delivered as an Intent object.

Android software framework

Android has a complex and deep set of components in its framework. The best way to understand this abstract stack is to use it.

Each Android app runs in its own security sandbox:

The Android operating system is a multi-user Linux system in which each application is a different user.

By default, the system assigns each application a unique Linux user ID (the ID is used only by the system and is unknown to the application). The system sets permissions for all the files in an application so that only the user ID assigned to that application can access them.

Each process has its own virtual machine (VM), so an application's code runs in isolation from other applications.

By default, every application runs in its own Linux process. Android starts the process when any of the application's components need to be executed, then shuts down the process when it's no longer needed or when the system must recover memory for other applications. Note that the following diagram is taken from the Android wiki page, and since Android 5.0 Lollipop system, the Dalvik VM has been officially replaced by a new runtime called ART (Android RunTime).