In this chapter, you’ll be introduced to three of the most versatile data persistence techniques in Android — preferences, local files, and SQLite databases — before looking at Content Providers.
Sav.. Read more
Creating an Earthquake Viewer
In the following example, you’ll create a tool that uses a USGS earthquake feed to display a list of recent earthquakes.
You will return to this Earthquake application .. Read more
Introducing the Dialog Class
----------------------------
The Dialog class implements a simple floating window that is constructed entirely within an Activity.
To use the base Dialog class, you crea.. Read more
Using Internet Resources:
With Internet connectivity and WebKit browser, you might well ask if there’s any reason to create native Internet-based applications when you could make a web-based version .. Read more
Introducing Adapters: Adapters are bridging classes that bind data to user-interface Views. The adapter is responsible for creat-ing the child views used to represent each item and providing access to.. Read more
To include a Broadcast Receiver in the application manifest, add a receiver tag within the applica-tion node specifying the class name of the Broadcast Receiver to register. The receiver node needs to.. Read more
As a system-level message-passing mechanism, Intents are capable of sending structured messages across process boundaries.
So far you’ve looked at using Intents to start new application components, b.. Read more
Using Intent Filters for Plug-ins and Extensibility
So far you’ve learned how to explicitly create implicit Intents, but that’s only half the story. Android lets future packages provide new functiona.. Read more
The anonymous nature of runtime binding makes it important to understand how Android resolves an implicit Intent into a particular application component.
As you saw previously, when using startActivi.. Read more
If an Intent is a request for an action to be performed on a set of data, how does Android know which application (and component) to use to service the request? Intent Filters are used to register Act.. Read more
Native Android applications also use Intents to launch Activities and sub-Activities.
The following noncomprehensive list shows some of the native actions available as static string con-stants in the.. Read more
At first glance, the subjects of this chapter may appear to have little in common; in practice, they represent the glue that binds applications and their components.
Mobile applications on most platf.. Read more
In the following example, you’ll be adding some simple menu functions to the To-Do List application you started in Chapter 2 and continued to improve previously in this chapter.
You will add the abil.. Read more
Submenus and Context Menus: Context menus are displayed using the same floating window as the submenus shown in Figure 4-5.
While their appearance is the same, the two menu types are populated differ.. Read more
To define a menu for an Activity, override its onCreateOptionsMenu method. This method is triggered the first time an Activity’s menu is displayed.
The onCreateOptionsMenu receives a Menu object as a.. Read more
Menus offer a way to expose application functions without sacrificing valuable screen space. Each Activity can specify its own Activity menu that’s displayed when the device’s menu button is pressed.
.. Read more
Handling User Interaction Events
To make your new widget interactive, it will need to respond to user events like key presses, screen touches, and button clicks. Android exposes several virtual event.. Read more
Creating completely new Views gives you the power to fundamentally shape the way your applica-tions look and feel. By creating your own controls, you can create User Interfaces that are uniquely suite.. Read more
Compound controls are atomic, reusable widgets that contain multiple child controls laid out and wired together.
When you create a compound control, you define the layout, appearance, and interaction.. Read more
The To-Do List example from Chapter 2 uses TextViews (within a List View) to display each item. You can customize the appearance of the list by creating a new extension of the Text View, overriding th.. Read more