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.Adapterthat defines how to bind the tag names for the user’s searches to theRecyclerView’s items. ClassMainActivity’sonCreatemethod creates an object of classSearchesAdapteras theRecyclerView’s adapter.Class
ItemDivider(Section 8.7) is a subclass ofRecyclerView.ItemDecorationthat theRecyclerViewuses 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access