7.7 Class MainActivity

Class MainActivity defines the app’s user interface, the logic for interacting with the OpenWeatherMap.org daily forecast web service and the logic for processing the JSON response from the web service. The nested AsyncTask subclass GetWeatherTask performs the web service request in a separate thread (Section 7.7.5). MainActivity does not require a menu in this app, so we removed the methods onCreateOptionsMenu and onOptionsItemSelected from the autogenerated code.

7.7.1 package Statement and import Statements

Figure 7.14 contains MainActivity’s package statement and import statements. We’ll discuss the imported types as we encounter them.

Fig. 7.14 Class MainActivity’s package statement and import statements.

Get Android How to Program, 3/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.