
public class myreceiver extends IntentReceiver
{
public void onReceiveIntent(Context arg0, Intent arg1)
{
// do something when this method is invoked.
}
}
Data management with ContentProvider
The ContentProvider is the Android mechanism for data-store abstraction. Let's
look at a specific type of data found on a mobile device: the address book or
contacts database. The address book contains all the contacts and phone numbers
a person might require when using a mobile phone. The ContentProvider is a
mechanism to abstract access to a particular data store. In many ways, the
ContentProvider acts in the role of a database server. Operations to read and
write content to a particular data store should be passed through an appropriate
ContentProvider, rather than accessing a file or database directly. There may be
both "clients" and "implementations" of the ContentProvider.
The next section introduces Android views, the UI mechanism for putting things on
the screen of an Android device.
Views
The Android activity employs views to display UI elements. Views follow one of the
following layout designs:
LinearVertical
Each subsequent element follows its predecessor by flowing beneath it in a
single column.
LinearHorizontal
Each subsequent element follows its predecessor by flowing to the right in a
single row.
Relative
Each subsequent element is described in terms of offsets from the prior
element.
Table
A series of rows and columns similar to HTML tables. Each cell can hold one
view element.
Once a particular layout (or combination of layouts) has been selected, individual
views are used to present the UI.
ibm.com/developerWorks developerWorks®
Develop Android applications with Eclipse
© Copyright IBM Corporation 1994, 2008. All rights reserved. Page 7 of 35
Comentarios a estos manuales