Best Practice for Component Designers

If you look at the design for the contacts application in Android, you will notice some patterns for designing with intents. To make intents known to the clients of this application, the contacts application defines them in three classes in a package called android.provider. contacts. These three classes are as follows:

contacts.Intents contacts.Intents.Insert //nested class contacts.Intents.UI //nested class

The top-level class contacts.Intents defines the primary intents that the contacts application will respond to and the events that the app generates as it does its work.

The nested class contacts.Intents.Insert defines the supporting intents and other constants to insert new records. The contacts.Intents.UI nested class defines a number of ways to invoke the UI. The intents also clarify the extra information needed to invoke them, including key names and their expected value types.

As you design your own content providers and activities that act upon those content providers, you might want to follow this pattern for making intents explicit by defining constants for them in interfaces or classes.

Was this article helpful?

0 0

Post a comment