Objectives
In this chapter you’ll:
Support both portrait and landscape device orientations.
Extend ListActivity
to create an Activity
that displays a list of items in a ListView
.
Enable users to interact with an app via an ImageButton
.
Manipulate collections of data.
Use SharedPreferences
to store key–value pairs of data associated with an app.
Use a SharedPreferences.Editor
to modify key–value pairs of data associated with an app.
Use an ArrayAdapter
to specify a ListView
’s data.
Use an AlertDialog.Builder
object to create dialogs that display options as Button
s or in a ListView
.
Use an implicit Intent
to open a website in a browser.
Use an implicit Intent
to display an intent chooser containing a list of apps that can share text.
Programmatically hide the soft keyboard.
4.2.1 Importing the App and Running It
4.2.2 Adding a Favorite Search
4.2.3 Viewing Twitter Search Results
4.2.7 Scrolling Through Saved Searches
4.3.3 Customizing a ListActivity
’s Layout
4.3.6 Intent
s for Launching Other Activities
4.4.2 activity_main.xml
Overview
4.4.3 Adding the GridLayout
and Components
4.4.4 Graphical Layout Editor Toolbar
4.4.5 ListView
Item’s Layout: list_item.xml
4.5 Building the MainActivity
Class
4.5.1 package
and import
Statements
4.5.3 Fields of Class MainActivity
4.5.4 Overriding Activity
Method onCreate
Self-Review Exercises | Answers to Self-Review Exercises | Exercises