What is the difference between ArrayAdapter , BaseAdapter and ListAdapter

喜欢而已 提交于 2019-11-27 00:47:58

问题


Could you please tell me difference between ArrayAdapter , BaseAdapter and ListAdapter.


回答1:


BaseAdapter as the name suggests, is a base class for all the adapters.

When you are extending the Base adapter class you need to implement all the methods like getCount(), getId() etc.

ArrayAdapter is a class which can work with array of data. You need to override only getview() method.

ListAdapter is a an interface implemented by concrete adapter classes.

BaseAdapter is an abstract class whereas ArrayAdapter and ListAdapter are the concrete classes.

ArrayAdapter and ListAdapter classes are developed since in general we deal with the array data sets and list data sets.




回答2:


ListAdapter

It is an interface that extended Adapter which is the bridge between a ListView and the data that backs the list.

BaseAdaper

Common base class of common implementation for an Adapter that can be used in both ListView (by implementing the specialized ListAdapter interface} and Spinner (by implementing the specialized SpinnerAdapter interface.

ArrayAdapter

A concrete BaseAdapter that is backed by an array of arbitrary objects.

Refer below links

  1. ListAdapter

  2. BaseAdapter

  3. ArrayAdapter



来源:https://stackoverflow.com/questions/11628742/what-is-the-difference-between-arrayadapter-baseadapter-and-listadapter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!