Android Adapter Simpleadapter and Baseadapter differences

Source: Internet
Author: User

Android adapters Simpleadapter and baseadapter

When designing a network program or data processing display program, you often usesimpleadapter  and baseadapter  to achieve.  adapter  is the adapter mode, which is the bridge between the data and the interface. baseadapter  is an abstract class that must be used to define subclasses and implement related methods. simpleadapter  is derived from  baseadapter , and the relevant methods have been implemented, so it can be used directly. There is not much difference between the two in the use effect, both can design a nearly identical interface. But on the use of methods,  baseadapter  need to create a subclass derived from the class, and implement some methods of the parent class, he can be based on our interface and the needs of the data free customization.  simpleadapter  can be used directly, but the data structure used by the adapter is  hashmap  If you need to manipulate the data object structure is too complex, such as a large number of members, member content is not a basic type, etc., it is necessary to write the relevant conversion code, which will facilitate the program's efficiency and maintainability of the poor  . Sometimes, we face the problem of which adapter to use. If the data structure is very simple, the operation of the database object members are very few, no non-basic type of data members, just as a simple display, then  simpleadapter  is a good choice, simple and efficient and fast. If there are many members, the members contain complex objects, such as  button , darwable , etc., using baseadapter  makes the code simple and efficient.

Http://www.tuicool.com/articles/fmQfMr

The difference is that the Simpleadapter data source is list< Map<string,?>, that is, the value of HashMap must be a simple type, otherwise a complex conversion.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.