Working with Intent classes

Intent classes are the communications network of the applications on the Android platform. In many ways the Android architecture is similar to larger Service-Oriented Architecture (SOA) approaches in that each Activity makes a type of Intent call to get something done, without knowing exactly what the receiver of the Intent may be.

In an ideal situation you don't care how a particular task gets performed; rather, you care that it is done and is completed to your requirements. That way, you can divide up what you need to get done at a particular time—your intent—and concentrate on the problem you are trying to solve, rather than worrying about specific underlying implementation details.

Intent classes are late binding, and this is one of the things that makes them a bit different from what you might be used to. This means they are mapped and routed to a component that can handle a specified task at runtime rather than at build or compile time. One Activity tells the platform, "I need a map to Langtry, TX, US," and another component, one the platform determines is capable, handles the request and returns the result. With this approach, individual components are decoupled and can be modified, enhanced, and maintained without requiring changes to a larger application or system.

With that concept and the advantages the design intends in mind, here we will look at exactly how an Intent is defined in code, how an Intent is invoked by an Activity, how Intent resolution takes place using IntentFilter classes, and some intents that are built into the platform ready for you to take advantage of.

0 0

Post a comment