Adapter and Adapter View

Adapter or Adapter View is so popular and that every time you see any app with a List of items or Grid of items so we can say for sure that this is using Adapter and Adapter View.

Usually, when we create a List of items and Grid of data then we are thinking which widget we should use to use a loop to iterate over the data and set the data to create the list or grid.

All these types of problems are solved by using Adapter and Adapter View.

Adapter View, is a View object, can be used just like we use any other interface widget and The only catch here is that it needs an Adapter to provide content to it as it is incapable of displaying data on its own.

What is an Adapter?

An adapter acts like a bridge between a data source and the user interface and It reads data from various data sources, converts it into View objects and provides it to linked Adapter view to create UI components.

You can create your own Adapter class by extending the BaseAdapter class, so that is the parent class for all other adapter classes. Android SDK also provides some ready-to-use(builtin) adapter classes, such as ArrayAdapter, SimpleAdapter etc.

What is an Adapter View?

An Adapter View can be used to display large sets of data very efficiently in form of List or Grid etc.., provided to it by an Adapter.

When we say efficiently, what do we mean?

An Adapter View is enough capable of displaying millions of items on the User Interface (UI), while keeping the memory and CPU usage very low and without any noticeable lag. Different Adapters follows different methods for this and the default Adapter provided in Android SDK follow the following tricks:

It only processes those View objects which are currently on-screen or are about to some on-screen. so no matter how large your data set is the Adapter View will always load only 5 or 6 or maybe 7 items at once depending upon the display size so it saves memory.
Suppose you have a series of data, like a String array with the following.

String days[] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};

Now, what an AdapterView to an AdapterView .So,The AdapterView then displays the data in the way you want.

Therefore, when you can take the data from a database or an ArrayList or any other data source and then, we can display that data in any arrangement and we can display it vertically (ListView) or in rows and columns (GridView) or in drop-down menu (Spinners), etc…

There are different kinds of AdapterViews, Let’s check at some of them:


It displays a vertically-scrollable data of views and where each view is positioned immediately below the previous view in the list.


GridView is a ViewGroup or collection of views that displays items in a two-dimensional, scrollable grid.


Spinners used to select one value from a set of values and touching the spinner displays a dropdown menu with all other available values which is from which the user can select a new one.

Every AdapterView usually uses some approach for using the Adapter.

Subscribe Now