concept RestaurantFinder in category android

appears as: RestaurtFinder, RestaurtFinder
Android in Action, Third Edition

This is an excerpt from Manning's book Android in Action, Third Edition.

Android 3.0 has introduced a new concept, the fragment, which lies somewhere between a view and an Activity. A fragment defines a reusable user interface chunk with its own lifecycle. Fragments are most useful if you wish to present multiple “screens” at once on a larger device such as a tablet. For example, in the RestaurantFinder, you could represent the ReviewCriteria in one fragment, the ReviewList in another, and the ReviewDetail in a third. A smartphone would display one fragment at a time, but on a tablet, you could show the list of reviews in one pane and the selected review’s detail in another pane. Fragments are more complicated than standard views, but in the long run they can reduce overall maintenance in your code by letting you keep a single codebase that supports significantly different user interfaces.

Other times, you want to use an Intent to accomplish some work, but you want to make sure that you handle it yourself. When you open a review in RestaurantFinder, you don’t want a third party to intercept that request and show its own review instead. In an explicit Intent invocation, your code directly specifies which component should handle the Intent. You perform an explicit invocation by specifying either the receiver’s Class or its ComponentName. The ComponentName provides the fully qualified class name, consisting of a String for the package and a String for the class.

4.1.3. Adding external links to RestaurantFinder

When we started the RestaurantFinder in listing 3.6, we used Intent objects to move between screens in our application. In the following listing, we finish the ReviewDetail Activity by using a new set of implicit Intent objects to link the user to other applications on the phone.