Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Adapter and AdapterView in Android?

Tags:

android

Beginning Android development, i am having a big problem understanding how listviews and gridviews work and the adapters and their role

am very grateful for anyone who would help me, that will be really a great favor for me.

like image 435
user3097053 Avatar asked Dec 12 '13 20:12

user3097053


People also ask

What is an AdapterView in Android?

AdapterView is a ViewGroup that displays items loaded into an adapter. The most common type of adapter comes from an array-based data source.

What are the different types of adapters in Android?

Android provides several subclasses of Adapter that are useful for retrieving different kinds of data and building views for an AdapterView ( i.e. ListView or GridView). The common adapters are ArrayAdapter,Base Adapter, CursorAdapter, SimpleCursorAdapter,SpinnerAdapter and WrapperListAdapter.

Why adapters are used in Android?

In Android, whenever we want to bind some data which we get from any data source (e.g. ArrayList, HashMap, SQLite, etc.) with a UI component(e.g. ListView, GridView, etc.) then Adapter comes into the picture. Basically Adapter acts as a bridge between the UI component and data sources.

What is an adapter class in Android?

Base class for an Adapter. Adapters provide a binding from an app-specific data set to views that are displayed within a RecyclerView . Parameters. <VH extends RecyclerView.ViewHolder> A class that extends ViewHolder that will be used by the adapter.


1 Answers

An Adapter is responsible for creating and binding data to views. An Adapter isn't an actual view, but instead produces them.

An AdapterView is a ViewGroup that gets its child views from an Adapter.

E.g. a ListView has a child view for each row in its list. Those child views are created and bound with data by an Adapter.

like image 160
Steve Prentice Avatar answered Sep 21 '22 16:09

Steve Prentice