8.5 MainActivity
Class
This app consists of three classes:
Class
MainActivity
—which we discuss in this section—configures the app’s GUI and defines the app’s logic.Class
SearchesAdapter
(Section 8.6) is a subclass ofRecyclerView.Adapter
that defines how to bind the tag names for the user’s searches to theRecyclerView
’s items. ClassMainActivity
’sonCreate
method creates an object of classSearchesAdapter
as theRecyclerView
’s adapter.Class
ItemDivider
(Section 8.7) is a subclass ofRecyclerView.ItemDecoration
that theRecyclerView
uses to draw a horizontal line between items.
Sections 8.5.1–8.5.10 discuss class MainActivity
in detail. This app does not need a menu, so we removed the MainActivity
methods onCreateOptionsMenu
and onOptionsItemSelected ...
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.