I want to know when, where and how adapters are used in the context of Android.
The information from Android's developer documentation was insufficient for me and I'd like to get a more detailed analysis.
I want to know when, where and how adapters are used in the context of Android.
The information from Android's developer documentation was insufficient for me and I'd like to get a more detailed analysis.
I would like to share my understanding.
It's an interface between the data source and your layout (most probably ListView).
Let's take the example of a mobile charger, or rather a USB cable. The wire can be considered as the adapter, while the data source and layout can be understood as the socket (plug-in point) and USB port (charging point) respectively.
In the case of mobile charging, the source of the power may be different, e.g. charging from a power bank, a socket or a laptop. The same is the case for the adapters used in Android. The data source may be changed depending upon the application requirement.
In short, an adapter in Android carries the data from a source
(e.g. ArrayList<>)
and delivers it to a layout (.xml file).
At the end, adapters are very useful to do a report. If one wants to show a report of some information, one can use this tool to show the data on the view.