

{"id":76793,"date":"2020-03-07T09:38:38","date_gmt":"2020-03-07T04:08:38","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=76793"},"modified":"2021-08-25T14:04:19","modified_gmt":"2021-08-25T08:34:19","slug":"android-adapters","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/android-adapters\/","title":{"rendered":"Android Adapters &#8211; The art of accessing the data items in Android"},"content":{"rendered":"<p>An adapter basically connects the User Interfaces and the Data Source. According to Android officials, <em>\u201cAn Adapter object acts as a bridge between an AdapterView and the data for that view. Android Adapters basically provides access to the data items.\u201d<\/em><\/p>\n<p>So we know, an adapter implements the Adapter Interface and acts as a link between a data set and an adapter view. An AdapterView is an object of a class extending the abstract AdapterView class. Now when we talk about the data, it can be anything that is present in Structured Manner. It also retrieves data from data set &amp; generates view objects based on that data. It shows the data in different views like <strong>GridView<\/strong>, <strong>ListView<\/strong>, <strong>Spinners<\/strong>, etc.<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/adapter-in-android.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-76840 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/adapter-in-android.jpg\" alt=\"working of android adapter\" width=\"600\" height=\"432\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/adapter-in-android.jpg 600w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/adapter-in-android-150x108.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/adapter-in-android-300x216.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/adapter-in-android-520x374.jpg 520w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<h3>Adapter View in Android<\/h3>\n<p>An Adapter View displays the set of data in the form of List or Grid provided by the Adapter. It has the capability to display a large number of items on the User Interface efficiently. An Android Adapter is responsible for taking the data from the source and put it in the AdapterView. And it is the responsibility of AdapterView to display the data.\u00a0Adaptors help us make the user interface interactive and friendly to use.<\/p>\n<p><em><strong>Learn to make UI interactive by using <a href=\"https:\/\/data-flair.training\/blogs\/android-ui-controls\/\">UI Controls<\/a> with DataFlair.<\/strong><\/em><\/p>\n<p>An android adapter vier can display the data on the Display screen in three forms that are:<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-adapter-views.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-76874 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-adapter-views.jpg\" alt=\"android adapter views\" width=\"400\" height=\"338\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-adapter-views.jpg 400w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-adapter-views-150x127.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-adapter-views-300x254.jpg 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<p>Let us see these Views one by one:<\/p>\n<h4>1. ListView<\/h4>\n<p>The speciality of ListView is that it shows the items in a Horizontal form, here each item lies below the other. These items are displayed in Vertically- Scrollable collection. The example is given below:<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-list-view.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-76875 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-list-view.jpg\" alt=\"android list view\" width=\"254\" height=\"359\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-list-view.jpg 254w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-list-view-106x150.jpg 106w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-list-view-212x300.jpg 212w\" sizes=\"auto, (max-width: 254px) 100vw, 254px\" \/><\/a><\/p>\n<h4>2. GridView<\/h4>\n<p>In a Grid View, each item is displayed in a tabular form or a 2-Dimensional view, that is in rows and columns. This is also a vertically-scrollable view. To understand this view, consider the following image:<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-grid-view.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-76876 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-grid-view.jpg\" alt=\"android grid view\" width=\"254\" height=\"359\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-grid-view.jpg 254w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-grid-view-106x150.jpg 106w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-grid-view-212x300.jpg 212w\" sizes=\"auto, (max-width: 254px) 100vw, 254px\" \/><\/a><\/p>\n<h4>3. Spinner<\/h4>\n<p>Spinner view is a different view when we talk about all three. In Spinner, we get to choose a value from a list of Values. This is like a dropdown menu that has a set of values from which the user can choose one.<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-spinners.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-76877 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-spinners.jpg\" alt=\"android spinners\" width=\"254\" height=\"359\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-spinners.jpg 254w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-spinners-106x150.jpg 106w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-spinners-212x300.jpg 212w\" sizes=\"auto, (max-width: 254px) 100vw, 254px\" \/><\/a><\/p>\n<h2>Types of Android Adapters<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/types-of-android-adapters.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-76878 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/types-of-android-adapters.jpg\" alt=\"android adapters types\" width=\"560\" height=\"458\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/types-of-android-adapters.jpg 560w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/types-of-android-adapters-150x123.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/types-of-android-adapters-300x245.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/types-of-android-adapters-520x425.jpg 520w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><\/h2>\n<p>Android provides us with following different types of Adapters that are used to fill the data in UI components:<\/p>\n<ul>\n<li><strong>BaseAdapter &#8211;<\/strong> BaseAdapter is the parent adapter for the rest of the Adapters.<\/li>\n<li><strong>CursorAdapter &#8211;<\/strong> This adapter makes it easy and more controlled to access the binding of data values.<\/li>\n<li><strong>ArrayAdapter &#8211;<\/strong> ArrayAdapter presents the items in a single list backed by an array.<\/li>\n<li><strong>Custom ArrayAdapter &#8211;<\/strong> It displays the custom list of an Array.<\/li>\n<li><strong>SimpleAdapter &#8211;<\/strong> SimpleAdapter is an easy adapter to map static data to the views through the XML file.<\/li>\n<li><strong>Custom SimpleAdapter &#8211;<\/strong> It displays a customized list and enables us to access the child data of the list or grid view.<\/li>\n<\/ul>\n<p>Now, we will see all these Android Adapters one by one:<\/p>\n<h3>1. BaseAdapter in Android<\/h3>\n<p>Base Adapter is a general implementation of an Adapter that is extended in other Android Adapters for their use.<\/p>\n<p>Other android adapters extend it to create a custom Adapter for displaying a common custom list item. To extend a BaseAdapter in a customized adapter we extend it as follows:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public class My_Adapter extends BaseAdapter{\r\n        \/\/overridden methods\r\n        public int getCount(){\r\n        \/\/code\r\n        }\r\n        public Object getItem(int i) {\r\n        \/\/code\r\n        }\r\n        \/\/ other methods\r\n}<\/pre>\n<h3>2. ArrayAdapter in Android<\/h3>\n<p>Whenever we need to arrange the data in ArrayList, we use the ArrayAdapter. The array adapter uses <strong>Object.toString()<\/strong> for each data object to create a view, and then place the result in a TextView. This type of android adapter is used for ListView, GridView or Spinner.<\/p>\n<p>To include it we can use ArrayAdapter as follows:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ArrayAdapter ( Context context, int resource, int textViewResourceId, Item[] objects)<\/pre>\n<p>ArrayAdapter is a class and can have various types of Constructors, those constructors are mentioned below:<\/p>\n<ul>\n<li>ArrayAdapter( Context context, int resource)<\/li>\n<li>ArrayAdapter( Context context, int resource, int textViewResourceId)<\/li>\n<li>ArrayAdapter( Context context, int resource, T[] objects)<\/li>\n<li>ArrayAdapter( Context context, int resource, textViewResourceId, T[] objects)<\/li>\n<li>ArrayAdapter( Context context, int resource, List&lt;T&gt; objects)<\/li>\n<li>ArrayAdapter( Context context, int resource, int textViewResourceId, List&lt;T&gt; objects)<\/li>\n<\/ul>\n<h3>3. Custom ArrayAdapter in Android<\/h3>\n<p>We implement a Custom ArrayAdapter when we want to add many UI widgets like EditText, TextViews, etc in the list and all at a time. To use a Custom ArrayAdapter, we need to create a <a href=\"https:\/\/data-flair.training\/blogs\/java-class-and-object\/\"><em><strong>Java class<\/strong><\/em><\/a> that will extend ArrayAdapter. This ArrayAdapter can override the methods of the BaseAdapter.<\/p>\n<p>To see how we can do it, we see the following:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Public class MyCustomAdapter extends ArrayAdapter{\r\n        Public CustomAdapter( Context context, int resource, int ResourceId, List objects) {\r\n        }\r\n  \/\/override other methods\r\n        }<\/pre>\n<h3>4. CursorAdapter in Android<\/h3>\n<p>We use CursorAdapter when we need to display some data using the <a href=\"https:\/\/www.sqlite.org\/\">SQLite<\/a> database query. This Android Adapter enables us to use the resources easily in ListView.<\/p>\n<p>To use it we can do the following:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public class MyCursorAdapter extends CursorAdapter {\r\n \/\/ Constructor and required methods \r\n}<\/pre>\n<h3>5. SimpleAdapter in Android<\/h3>\n<p>A simple Adapter is used for static data that does not change dynamically. It provides an easy way to add static data in a view that are defined in the XML file. We can add it using the following:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">SimpleAdapter (Context context, List&lt;? Extends Map&lt;String, ?&gt;&gt; data, int resource, String[] from, int[] to)<\/pre>\n<h3>6. Custom SimpleAdapter in Android<\/h3>\n<p>We use CustomSimpleAdapter to implement custom Adapters. To implement a list of items backed by an Array we need to use ArrayAdapter. So, to customize a ListView or a GridView we would need to implement SimpleAdapter first. Further, if we want more customization in the Items where we have many items then we need to implement the <strong>Custom SimpleAdapter<\/strong>.<\/p>\n<p><em>Any doubts in Android Adapters article till now? Ask in the comment section.<\/em><\/p>\n<h3>Methods of Android Adapters<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/methods-of-android-adapters.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-76879 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/methods-of-android-adapters.jpg\" alt=\"methods of android adapters\" width=\"760\" height=\"428\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/methods-of-android-adapters.jpg 760w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/methods-of-android-adapters-150x84.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/methods-of-android-adapters-300x169.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/methods-of-android-adapters-520x293.jpg 520w\" sizes=\"auto, (max-width: 760px) 100vw, 760px\" \/><\/a><\/h3>\n<p>There are certain methods of Adapter class that are mentioned below:<\/p>\n<ul>\n<li><strong>getCount() &#8211;<\/strong> This method represents the number of items present in the data set.<\/li>\n<li><strong>hasStableIds() &#8211;<\/strong> This method indicates whether the Item Ids are stable under changes on the underlying data.<\/li>\n<li><strong>getItem(int position) &#8211;<\/strong> This method gets the data item associated with a particular position in the data set.<\/li>\n<li><strong>getItemId(int position) &#8211;<\/strong> This method gets the Id of the item associated with a particular position in the list.<\/li>\n<li><strong>getViewTypeCount() &#8211;<\/strong> This method returns the number of types of Views created using getView().<\/li>\n<li><strong>getItemViewType(int position) &#8211;<\/strong> This method gets the type of View that would be created using the getView() method.<\/li>\n<li><strong>getView(int position, View convertView, ViewGroup parent) &#8211;<\/strong> This method displays the data at a position in the data set.<\/li>\n<li><strong>registerDataSetObserver(DataSetObserver observer) &#8211;<\/strong> This method registers the observer that is called when the changes in the data occur.<\/li>\n<li><strong>unregisterDataSetObserver(DataSetObserver observer) &#8211;<\/strong> This method unregisters the observer that was registered using the registerDataSetObserver(DataSetObserver observer) method.<\/li>\n<\/ul>\n<h3>Implementation of Adapters in Android<\/h3>\n<p>Now we will implement it in our application using the following steps:<\/p>\n<p><strong>Step 1.<\/strong> First of all, we will create a new project and name it. I have named my application <strong>\u201cMy Adapter\u201d<\/strong>.<\/p>\n<p><strong>Step 2.<\/strong> Next we will create the layout for it in the <strong>activity_main.xml<\/strong> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;LinearLayout       xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n   xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\r\n   android:layout_width=\"match_parent\"\r\n   android:layout_height=\"match_parent\"\r\n   android:orientation=\"vertical\"\r\n   tools:context=\".MainActivity\"&gt;\r\n\r\n   &lt;TextView\r\n       android:id=\"@+id\/tV1\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_centerHorizontal=\"true\"\r\n       android:layout_marginLeft=\"90dp\"\r\n       android:layout_marginTop=\"40dp\"\r\n       android:fontFamily=\"@font\/amarante\"\r\n       android:text=\"DataFlair \"\r\n       android:textColor=\"@color\/colorPrimaryDark\"\r\n       android:textSize=\"50dp\" \/&gt;\r\n\r\n   &lt;ListView\r\n       android:id=\"@+id\/Dog_List\"\r\n       android:layout_width=\"match_parent\"\r\n       android:layout_height=\"wrap_content\"&gt;&lt;\/ListView&gt;\r\n\r\n&lt;\/LinearLayout&gt;<\/pre>\n<p><strong>Step 3.<\/strong> We will write the following code in the <strong>MainActivity.java<\/strong> file.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.DataFlair.myadapter;\r\n\r\nimport android.os.Bundle;\r\nimport android.widget.ArrayAdapter;\r\nimport android.widget.ListView;\r\n\r\nimport androidx.appcompat.app.AppCompatActivity;\r\n\r\npublic class MainActivity extends AppCompatActivity {\r\n\r\n   String[] Dogs = {\"Husky\", \"Labrador\", \"Chow Chow\", \" Beagle \", \" Rottweiler \", \" Doberman \", \"Chihuahua\", \" Pit Bull \", \"Pug\", \"Golden Retriever \", \"German Shepherd\", \"Great Dane\", \"Boxer\"};\r\n\r\n   @Override\r\n   protected void onCreate(Bundle savedInstanceState) {\r\n       super.onCreate(savedInstanceState);\r\n       setContentView(R.layout.activity_main);\r\n\r\n       ArrayAdapter my_adapter = new ArrayAdapter&lt;String&gt;(this,\r\n               R.layout.my_list, Dogs);\r\n\r\n       ListView List = findViewById(R.id.Dog_List);\r\n\r\n       List.setAdapter(my_adapter);\r\n   }\r\n}<\/pre>\n<p><strong>Step 4.<\/strong> Now we will create a file to customize the listview that would be shown. For that create a file <strong>my_list.xml<\/strong> and write the following code.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n\r\n&lt;TextView xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n   android:id=\"@+id\/customize\"\r\n   android:layout_width=\"fill_parent\"\r\n   android:layout_height=\"fill_parent\"\r\n   android:fontFamily=\"@font\/amiri\"\r\n   android:padding=\"10dp\"\r\n   android:textColor=\"#4A0505\"\r\n   android:textSize=\"20dp\"\r\n   android:textStyle=\"bold\"&gt;\r\n\r\n&lt;\/TextView&gt;<\/pre>\n<p><strong>Step 5.<\/strong> After writing this, we will run the code:<\/p>\n<p><strong>i.<\/strong> This is the <strong>ListView<\/strong>.<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/scrollable-listview.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-76845 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/scrollable-listview.jpg\" alt=\"list view in android\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/scrollable-listview.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/scrollable-listview-84x150.jpg 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/scrollable-listview-169x300.jpg 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>ii.<\/strong> This list is <strong>scrollable<\/strong>.<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/listview.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-76842 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/listview.jpg\" alt=\"scrollable list\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/listview.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/listview-84x150.jpg 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/listview-169x300.jpg 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h2>Summary<\/h2>\n<p>So in this article, we have read about the Adapters in Android. We saw what are android adapters, and their types. We also went through the methods that are required to implement Android Adapters. In the end, we also implemented Adapter through ListView in our application. We will read them in detail in the coming articles.<\/p>\n<p><em><strong>Learn to build your first <a href=\"https:\/\/data-flair.training\/blogs\/create-android-app\/\">Android App<\/a> with DataFlair.<\/strong><\/em><\/p>\n<p>I hope you liked DataFlair&#8217;s Android Adapters article. Do refer our sidebar for more Android Tutorials.<\/p>\n<p>Happy Learning\ud83d\ude03<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1164,&quot;href&quot;:&quot;https:\\\/\\\/www.sqlite.org&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251206151809\\\/https:\\\/\\\/sqlite.org\\\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 02:28:28&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-16 16:17:36&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-20 11:53:33&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-30 18:22:20&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-06 07:28:14&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-12 16:23:39&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-15 20:22:39&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-21 18:27:24&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-29 04:17:47&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-01 10:49:08&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-10 04:00:11&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-14 05:23:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-20 11:33:26&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-24 06:41:48&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-04 21:48:37&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-12 02:41:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-20 05:19:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-23 05:42:13&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-29 03:44:36&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-05 09:37:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-12 16:22:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-15 16:31:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-23 18:10:27&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-29 09:56:54&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-07 03:27:04&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-15 23:45:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-20 05:04:06&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-03 11:12:17&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-10 12:48:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-16 22:16:58&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-16 22:16:58&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>An adapter basically connects the User Interfaces and the Data Source. According to Android officials, \u201cAn Adapter object acts as a bridge between an AdapterView and the data for that view. Android Adapters basically&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":76880,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18722],"tags":[22080,22079,22078,22084,22085,22083,22082,22081],"class_list":["post-76793","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","tag-adapter-view-in-android","tag-adapters-in-android","tag-android-adapters","tag-arrayadapter-in-android","tag-baseadapter-in-android","tag-implementation-of-adapters-in-android","tag-methods-of-android-adapters","tag-types-of-android-adapters"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android Adapters - The art of accessing the data items in Android - DataFlair<\/title>\n<meta name=\"description\" content=\"Study the concept of Android Adapters, its various types and methods. Also, learn to implement adapters in Android in your application with the help of examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/android-adapters\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Adapters - The art of accessing the data items in Android - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Study the concept of Android Adapters, its various types and methods. Also, learn to implement adapters in Android in your application with the help of examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/android-adapters\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-07T04:08:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-25T08:34:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-adapters.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Adapters - The art of accessing the data items in Android - DataFlair","description":"Study the concept of Android Adapters, its various types and methods. Also, learn to implement adapters in Android in your application with the help of examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/android-adapters\/","og_locale":"en_US","og_type":"article","og_title":"Android Adapters - The art of accessing the data items in Android - DataFlair","og_description":"Study the concept of Android Adapters, its various types and methods. Also, learn to implement adapters in Android in your application with the help of examples.","og_url":"https:\/\/data-flair.training\/blogs\/android-adapters\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-03-07T04:08:38+00:00","article_modified_time":"2021-08-25T08:34:19+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-adapters.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/android-adapters\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/android-adapters\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Android Adapters &#8211; The art of accessing the data items in Android","datePublished":"2020-03-07T04:08:38+00:00","dateModified":"2021-08-25T08:34:19+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-adapters\/"},"wordCount":1261,"commentCount":1,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-adapters\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-adapters.jpg","keywords":["Adapter View in Android","Adapters in Android","Android Adapters","ArrayAdapter in Android","BaseAdapter in Android","Implementation of Adapters in Android","Methods of Android Adapters","Types of Android Adapters"],"articleSection":["Android Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/android-adapters\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/android-adapters\/","url":"https:\/\/data-flair.training\/blogs\/android-adapters\/","name":"Android Adapters - The art of accessing the data items in Android - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-adapters\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-adapters\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-adapters.jpg","datePublished":"2020-03-07T04:08:38+00:00","dateModified":"2021-08-25T08:34:19+00:00","description":"Study the concept of Android Adapters, its various types and methods. Also, learn to implement adapters in Android in your application with the help of examples.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/android-adapters\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/android-adapters\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/android-adapters\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-adapters.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-adapters.jpg","width":802,"height":420,"caption":"adapters in android"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/android-adapters\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Android Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/android\/"},{"@type":"ListItem","position":3,"name":"Android Adapters &#8211; The art of accessing the data items in Android"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/76793","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=76793"}],"version-history":[{"count":5,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/76793\/revisions"}],"predecessor-version":[{"id":76881,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/76793\/revisions\/76881"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/76880"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=76793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=76793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=76793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}